Just a thought on sed

Chad Simmons polpak at yahoo.com
Fri May 3 09:11:52 PDT 2002


--- Chad Simmons <polpak at yahoo.com> wrote:
> 
> --- Marc Heerdink <marc at linuxfromscratch.org> wrote:
> > We currently only have these constructs:
> > 
> > mv file file.backup &&
> > sed 's/foo/bar/g' file.backup >file
> > 
> > thus saving a backup copy in case something went wrong. Modifying a file
> > in place would only be possible if we'd do it like this:
> > 
> > cp file file.backup &&
> > perl -i -pe 's/foo/bar/g' file
> > 
> > and we'd have 2 lines of commands anyway.
>  
> Actually, the options here allow you to specify a backup also..
> 
> perl -i.backup -pe 's/foo/bar/g' file
> 
> The above will accomplish the same as your 2 line version above

Oh, and for the record.. I think perl is great, but I personally vote for patch
files above both sed and perl.

Chad Simmons

=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++:+ a-- C+++$>++++ UBLS++++$ 
P+++(--)$ L++>+++ E--- W+>++$ N !o K? w(--) !O 
M- !V PS+ PE(++) Y+ PGP->+ t- 5 X+() R(+) tv+@ 
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list