Skip to main content
Solved

add dot at every line in txt file


Forum|alt.badge.img

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

Best answer by erik_jan

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.

View original
Did this help you find an answer to your question?

7 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • Best Answer
  • May 2, 2018

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.


Forum|alt.badge.img
  • Author
  • May 2, 2018

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 )


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • May 2, 2018
erik_jan wrote:

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

 


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • May 2, 2018
mgm21m wrote:

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.

 

 


Forum|alt.badge.img
  • Author
  • May 2, 2018

Thanks a lot Erik

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


Forum|alt.badge.img
  • Author
  • May 2, 2018
erik_jan wrote:
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

 

 

 


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • May 2, 2018
mgm21m wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings