how to replace strings in file based on values from another file? (example inside)

Posted by thaold on Stack Overflow See other posts from Stack Overflow or by thaold
Published on 2011-03-12T16:08:19Z Indexed on 2011/03/12 16:10 UTC
Read the original article Hit count: 167

Filed under:
|
|
|

Hi,

how to replace strings in file, based on values from another file.

Example, 2 files - input, output

input:

12345 1

output:

(1,'a lot of text', 'some other info',0,null, 12345),

(2,'a lot of text', 'some other info',0,null, 12345),

(3,'a lot of text', 'some other info',0,null, 12345),

(4,'a lot of text', 'some other info',0,null, 12345),

(5,'a lot of text', 'some other info',0,null, 12345);

Needs to be done:

read values from file 'input', and replace all '12345' with '1' in file 'output'. Thanks for help in advance

© Stack Overflow or respective owner

Related posts about shell

Related posts about unix