help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple 'sed' question


From: Brenda J. Butler
Subject: Re: simple 'sed' question
Date: Sat, 24 Dec 2005 00:53:49 -0500
User-agent: Mutt/1.5.11

On Fri, Dec 23, 2005 at 07:15:20PM -0800, namesagame-usenet@yahoo.com wrote:
> Hi,
> 
> How do I change a line like this:
>      bar
> to:
>     foo
>    bar
> ???


find | while read YOURFILE; do

        mv $YOURFILE $YOURFILE.bak

        sed '/bar/a\
     foo' $YOURFILE.bak > $YOURFILE

        rm $YOURFILE.bak

done


You probably want to test this before you use it.

cheerio,
bjb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]