[plug] Find and Replace in multiple files
Harry McNally
harrymc at decisions-and-designs.com.au
Sun Jul 13 12:04:35 WST 2003
On Sat, 12 Jul 2003 19:16:17 +0800 Harry McNally <harrymc at decisions-and-designs.com.au> wrote:
> On Sat, 12 Jul 2003 11:33:08 +0800 Weirdo <linuxalien at optusnet.com.au> wrote:
>
> > He would have an input string "!***" and a replace string "!*->"
> > It needs to be ether a shell command or a script where the input and
> > replace strings are set at the top or somewhere easy to find.
> > Thanks
> > Tim
>
> Saturday brain fade meant I needed to google:
> perl one-liner "search and replace"
> gave:
> http://forums.devshed.com/archive/6/2003/02/2/51863
>
> so you can do this:
>
> perl -pe 's/!\*\*\*/!\*-/g' *
Quiet Sunday so I tested it myself. Before anyone beats me to it,
yep, it's broken. *slaps forehead, eats iced donut*
Now, -this- should work .. FLW
perl -pi -e 's/!\*\*\*/!\*-/g' *
Have a look at the -i switch here to understand why:
http://www-2.cs.cmu.edu/People/rgs/pl-opt.html
cu
Harry
--
linux.conf.au 2004 The Australian Linux Technical Conference
http://lca2004.linux.org.au/ 12-17 January 2004, Adelaide, South Australia
Are you a computer angel? http://www.computerangels.org.au/
More information about the plug
mailing list