Just a thought on sed

Rob 'Feztaa' Park feztaa at shaw.ca
Thu May 2 20:36:28 PDT 2002

In order to modify a file with sed, we have to use a tempfile (ie,
move the file then sed it back).

I suggest we simplify things a bit by using "perl -i -pe" instead of
sed. The -i option makes perl modify the file in place (no tempfile),
and the -pe bit makes perl act just like sed. So you could replace
something like this:

    mv file file~ &&
    sed 's/foo/bar/g' file~ > file &&
    rm file~

With this:

    perl -i -pe 's/foo/bar/g' file

What do you guys think? ;)

Rob 'Feztaa' Park
feztaa at shaw.ca
Without coffee he could not work, or at least he could not have worked in the
way he did.  In addition to paper and pens, he took with him everywhere as an
indispensable article of equipment the coffee machine, which was no less
important to him than his table or his white robe.
		-- Stefan Zweigs, Biography of Balzac
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