I have some ad hoc tools, that help me with special text editing tasks. Like doing search and replace in a text file, with a list of search and replace terms. Or looking for assignment statements in the source code of a program, and replacing each variable with its value.
I decided to bundle these ad hoc scripts, into a single generic script, a new tool: texteditor.py
Here is an example, take text file example.txt with the following content:
There is an apple on the sun.
It is nice and warm.
And CSV file sar.csv with the following content:
apple,pear
sun,moon
The following sarcsv command edits file example.txt with sar.csv:
./texteditor.py input=example.txt edit=sarcsv,file=sar.csv output=-
The output of this command is:
There is an pear on the moon.
It is nice and warm.
Click to Open Code Editor