I would like to perform the following operation:
Given a file like this:
update FOO set STATUS="X" where ID=<REPLACE>;
insert into BAR (Z,W) values(<REPLACE>, 42);
And a file like this:
25478975
65897895
Give me a file with each line in the second file inserted in the <REPLACE>
positions in the first, like this:
update FOO set STATUS="X" where ID=25478975;
insert into BAR (Z,W) values(25478975, 42);
update FOO set STATUS="X" where ID=65897895;
insert into BAR (Z,W) values(65897895, 42);
It probably won't take me too long to write a simple Python program to do this, but I strongly suspect I could do it by combining a few GNU/Linux commandline-tools in the right way. Can anyone show me how?
1 Answers