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.
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?
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.