Re: Sed Command

From: Yong Huang <>
Date: Sat, 14 Nov 2009 08:29:52 -0800 (PST)
Message-ID: <>

>> > end;-----> end; /
> sed -e 's/end;/&\n\//' <your filename here> > <output file here>

Indeed "end;" and "/" should be on separate lines, not "end; /".

If you use GNU sed as on Linux, there're many more options. The in-place option obviates the need you explicitly create a temp file:

sed -i 's/end;/&\n\//' <your filename here>

It can save a lot of time if you modify many files with a shell script. Without GNU sed, just use Perl's in-place edit:

perl -pi -e 's/end;/&\n\//' <your filename here>

It works on Windows too (you have to create backup files which you can just delete later: perl -pi.bak -e "s/end;/$&\n\//" filename).

Yong Huang       

Received on Sat Nov 14 2009 - 10:29:52 CST

Original text of this message