[clug] global string replacement
pbarker at barker.dropbear.id.au
Fri Aug 15 16:38:36 EST 2003
On Fri, 15 Aug 2003, Adrian Blake wrote:
> I need to do a global string replacement on multiple files within a
> e.g. replace KPushButton with QPushButton
> with multiple occurrences per file on all files within a directory.
> There must be a one line command, but what is it?
Nonono, not "a" "more than one"
find . -type f | xargs perl -pi -e 's/foo/bar/g'
Or there-abouts. I actually wrote a script "slaughter.pl" dto do something
similar a long time ago. Still use it every now and then.
Peter Barker | N _--_|\ /---- Barham, Vic
Programmer,Sysadmin,Geek | W + E / /\
pbarker at barker.dropbear.id.au | S \_,--?_*<-- Canberra
You need a bigger hammer. | v [35S, 149E]
"They'll need a whole new Orwellian pseudo-crime-name for that... I
suggest "digital molestation of kittens". - Jeremi (14640) from Slashdot
More information about the linux