I need to update a text file which contains the settings for an executable tool. It would be really useful if I could automate this in FME.
The text file is saved in UTF-8 format and for example, lines two and three contain the variables for START_TIME and END_TIME:
START_TIME=2005/01/01 00:00
END_TIME=2007/12/31 23:59
How can FME be used to change the two dates, 2005/01/01 and 2007/12/31?
Thank you, Rob
Best answer by dustin
FME reads lines of text as individual features using the Text Reader, and puts the text into an attribute 'text_line_data'. You could then filter the features by 'text_line_data BEGINS WITH START_TIME' AND 'text_line_data BEGINS WITH END_TIME' using a Tester or TestFilter.
I would probably setup two Text parameters in the workspace, one for START and one for END, for which you will enter the desired date/times. Using Regex Replacement in the StringReplacer, the date/time value would be replaced with what is input in the parameters. The resulting workspace would look something like the screen shot below. I don't know the Counter/Sorter is necessary, but it will ensure the lines of text are written in the same order.
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.
FME reads lines of text as individual features using the Text Reader, and puts the text into an attribute 'text_line_data'. You could then filter the features by 'text_line_data BEGINS WITH START_TIME' AND 'text_line_data BEGINS WITH END_TIME' using a Tester or TestFilter.
I would probably setup two Text parameters in the workspace, one for START and one for END, for which you will enter the desired date/times. Using Regex Replacement in the StringReplacer, the date/time value would be replaced with what is input in the parameters. The resulting workspace would look something like the screen shot below. I don't know the Counter/Sorter is necessary, but it will ensure the lines of text are written in the same order.
FME reads lines of text as individual features using the Text Reader, and puts the text into an attribute 'text_line_data'. You could then filter the features by 'text_line_data BEGINS WITH START_TIME' AND 'text_line_data BEGINS WITH END_TIME' using a Tester or TestFilter.
I would probably setup two Text parameters in the workspace, one for START and one for END, for which you will enter the desired date/times. Using Regex Replacement in the StringReplacer, the date/time value would be replaced with what is input in the parameters. The resulting workspace would look something like the screen shot below. I don't know the Counter/Sorter is necessary, but it will ensure the lines of text are written in the same order.
What transformer would you recommend to filter the features by?