Example : search and replace
File-Search-Replace.dss replaces occurrences of search items in a string set with their corresponding replacement ("Other text") entries :
In this example, occurrences of "2002-2009" are replaced with "2002-2010", etc. Any number of Text / Other text pairs can be specified.
File-Search-Replace also generates 2 results summaries :
- An HTML results file with a table showing which files changed and how many replacements were made in each file (example: File-Search-Replace-results.htm)
- A simple text file listing the files that changed (example: File-Search-Replace-changed-files.txt)
This transformation works by dividing the input into two categories :
- the text strings specified in "new text",
- everything else ("*", asterisk) :
The action for the * ("everything else") node is simply: send the associated text to the output file.
The action for the "new text" node is: send the replacement text defined in "new text" to the output file.
So, everything is sent to the output file "as-is" except the "new text" entries, which are replaced with their "Other text" entries.