I'm trying to come up with a sed script to run from the shell. I need to be able to read in a list of UUIDs from an external file, which contains two columns
origtexta replacementa origtextb replacementb origtextc replacementc
The script needs to act recursively on all txt files below the current folder, look for any instance of 'origtext?' and replace with the corresponding text from column 2. It would be great if the script could be stored in /home/myuser/Scripts/ and aliased to be able to be run from anywhere I invoke it, and would also be nice if the script saved the original txt file as .txt.orig before changing it.
I've been testing this bit so far:
#!/bin/sed while read n k; do sed -i 's/$n/$k/g' *.txt; done < list
which I found in this thread: How to replace a list of strings by another list
It seems to be doing something, because the dates of the files change to the current date/time, but no text is actually replaced so I'm not at all sure how to get this working.