Solved

add dot at every line in txt file


Badge

Hello All

I'm new to FME but i think it's a great tool to help

anyway i have this problem that i hope that somebody can help me to solve it

I have a TXT file , most of the sentence are not with dot at the end.

I need to add a dot at the end of every sentence and then save the TXT file back again with the same encoding settings ( I want to make this thing to go automatically)

any help guys

thanks

icon

Best answer by erik_jan 2 May 2018, 18:50

View original

7 replies

Userlevel 2
Badge +16

Use the Text reader with the setting to not read the whole file as one feature:

The use the StringSearcher, searching by \\.$ to check if the line ends with a dot.

If not, use the StringConcatenator to add a dot to the line.

Then use a Text writer to write the text line by line.

Badge

firstly thank you very much for your response , but can we do it step by step

I tried the string concatenator but without any luck ( what to write there )

Userlevel 2
Badge +16

Use the Text reader with the setting to not read the whole file as one feature:

The use the StringSearcher, searching by \\.$ to check if the line ends with a dot.

If not, use the StringConcatenator to add a dot to the line.

Then use a Text writer to write the text line by line.

See image and attached example (FME 2018):

 

 

 

textline2textline.fmwt

 

Userlevel 2
Badge +16

firstly thank you very much for your response , but can we do it step by step

I tried the string concatenator but without any luck ( what to write there )

I have added a screenshot and a template with the workflow.

 

 

Badge

Thanks a lot Erik

another quick thing ,, it only work for certain file or I can use a watch folder for all files

Badge
I have added a screenshot and a template with the workflow.

 

 

Thanks a lot Erik

 

 

another quick thing ,, it only work for certain file or I can use a watch folder for all files

 

 

 

Userlevel 2
Badge +16

Thanks a lot Erik

another quick thing ,, it only work for certain file or I can use a watch folder for all files

You can use this workflow for any text file.

 

I used a log (.LOG) file, because that was the first I found.

 

 

Reply