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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • 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+26
  • Contributor
  • 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.

See image and attached example (FME 2018):

 

 

 

textline2textline.fmwt

 


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • 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 )

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
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+26
  • Contributor
  • 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

You can use this workflow for any text file.

 

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