[Techtalk] Re: real life kewl text-processing and regexps samples
rb at tertius.net.au
Sun Jan 11 07:48:27 EST 2004
dominik.schramm at gmxpro.net wrote:
> Ricky Buchanan <rb at tertius.net.au> writes:
> > [...]
> > perl -pie 's/\bgossamer\b/rb/g' *.txt
> > will swap every instance of the word (as a word) "gossamer" to "rb" in
> > *.txt in the current directory, making a backup of each file as
> > originalfilename.bak (that's the -i) just in case of grevious error (and
> If I read perlrun(1) correctly -i alone does not create backup files.
> -i.blah does, with extension .blah added to the original file name.
Oops, you're right. The snippet was actually
perl -pi.bak e 's/\bgossamer\b/rb/g' *.txt
: Usual state: (e) None of the above.
: rb at tertius.net.au http://tertius.net.au/~rb/
: The world is so empty if one thinks only of mountains, rivers
: and cities; but to know someone who thinks and feels with us,
: and who, though distant, is close to us in spirit, this makes
: the earth for us an inhabited garden. -- Goethe
More information about the Techtalk