I want to run a find and replace using a series of value pairs taken from a file (or two files, if that makes the task any easier). The find and replace strings are literal ones, not regexes in the practical sense. At the moment the file is tab-delimited, findstring \t replacestring
, one pair per line, but I can change that as required.
I know a little about regex but with Unix commands I really need clear "copy and paste" instructions. Earlier in this project I was pleased to discover grep -f
to get find strings from a file, but it seems that grep can't do the same thing for the replace strings.
Can I do this with a mixture of grep, sed and so on? The thread above explains how to pipe grep to sed, but then I need to tell sed how to read replace strings from the file.
I'm on macOS (with homebrew) if that makes a difference.