Let's say I'm George Orwell and I want to replace all instances of "big" with "small", "rich" with "poor", "smart" with "stupid", etc across a bunch of files. So I create a text file with one line per substitution:
file: substs.csv
big, small
rich, poor
smart, stupid
Now I want to apply those substitutions in substs.csv
globally across a bunch of files. I assume this would use a sed
script. Note that I'm happy to format substs.csv to have any format, as long as its one substitution pair per line.
What's the right tool, and what's the script that will do this?
Edit 1: It's fine to operate on just one file at a time. I can do foreach
or equivalent...
Edit 2: I can guarantee that substitutions on the right hand side don't appear on the left hand side, i.e., order of operation won't matter.
[I'm tempted to just bust out python and do it there. But this is a chance to refresh my unix tools chops...]