Re: Sed Command
From: Yong Huang <yong321_at_yahoo.com>
Date: Sat, 14 Nov 2009 08:29:52 -0800 (PST)
Message-ID: <167442.8221.qm_at_web80602.mail.mud.yahoo.com>
>> > end;-----> end; /
>
> sed -e 's/end;/&\n\//' <your filename here> > <output file here>
Date: Sat, 14 Nov 2009 08:29:52 -0800 (PST)
Message-ID: <167442.8221.qm_at_web80602.mail.mud.yahoo.com>
>> > 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
-- http://www.freelists.org/webpage/oracle-lReceived on Sat Nov 14 2009 - 10:29:52 CST