sed, awk, or something...help meeeeeeeeeee

Sharpe, Sam J sam.sharpe+lists.redhat at gmail.com
Mon Sep 28 18:33:13 UTC 2009


2009/9/28 Kanwar Ranbir Sandhu <m3freak at thesandhufamily.ca>:
> On Mon, 2009-09-28 at 19:48 +0200, Joerg Bergmann wrote:
>> Probably it's not what you want, but I would prefer writing a
>>
>> 50 lines standard C program for that task...
>
> Gah!  'Probably' isn't the right word.
>
> More reading and now I've got something along the lines of what I want
> to do, but it's obviously not going to work:
>
> sed '/BB/r file2' file1
>
> This will dump the contents of file2 after each "BB" line in file1.
> That's not what I'm after.
>
> Is there a way in sed to read in one line at a time from file2 to
> replace "BB" from file1 (as I explained earlier)?

Yes, but it involves reading the man page for sed - I'm not totally
sure you are capable of doing that.

I suggest looking at the output of "man sed", finding the section
about the command "r" and then reading the next few lines.

-- 
Sam




More information about the fedora-list mailing list