Saturday 23 March 2019

linux - How to replace a list of strings by another list

I have a file which has (many) strings I'd like to replace, so I thought about using a simple command like:


sed 's/string1/string2/g' file1 > out  

However, there are too many strings for that to be repeated manually. So I made a list of all the strings to be replaced, each in a line, and named it file A. Then I made a list of all the replacement strings, and named it file B.


Is there a way to do something like:


sed 's/line i of file A/line i of file B/g' file1 > out

for each line of file A?

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...