[clug] global string replacement
Steven Hanley
sjh at wibble.net
Fri Aug 15 16:33:29 EST 2003
On Fri, Aug 15, 2003 at 04:23:39PM +1000, Adrian Blake wrote:
> I need to do a global string replacement on multiple files within a
> directory
>
> 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?
perl -i -pne 's/KPushButton/QPushButton/g' *
-i is inplace editing, e is execute, n is line at a time input, cant
remember p off the top of my head.
The * is assuming you run the command from the directory you want to do it
in and that you want to perform this on all files there.
using perl because overkill is just enough <g>
See You
Steve
--
Men are from Earth. Women are from Earth. Deal with it.
sjh at wibble.net http://svana.org/sjh
You are subtle as a window pane standing in my view
but I will wait for it to rain so that I can see you
Anticipate - Ani
More information about the linux
mailing list