Hi All,
I don't know if I should use sed for what I'm about to ask, but it seems
like a good idea. If awk is better, or something else entirely, that's
fine too.
I have two files. File "1" looks like this:
AA
BB
CC
DD
AA
BB
CC
DD
File "2" looks like this:
BBBB1
BBBB2
BBBB3
So, "BB" in file "1" always occurs in the same spot (i.e. between
lines
AA and CC). Knowing that, how do I replace the first occurrence of "BB"
in file "1" with "BBBB1" from file 2, the second occurrence of
"BB" in
file "1" with "BBBB2" from file 2, and so on?
I think a bash 'for' or 'while' loop may be useful here, too. But,
it's
the sed/awk/whatever bits I don't know how to do. I've read some of the
man/info page, looked up sed help on the net, etc. I'm still not sure
how to do the above with sed.
Thanks in advance!
Regards,
Ranbir
--
Kanwar Ranbir Sandhu
Linux 2.6.27.30-170.2.82.fc10.x86_64 x86_64 GNU/Linux
13:29:18 up 9 days, 3:04, 3 users, load average: 1.13, 0.37, 0.18