[Gllug] I know this is a bit of a n00b question

Richard Jones rich at annexia.org
Tue Oct 7 20:25:11 UTC 2003


On Tue, Oct 07, 2003 at 08:56:18PM +0100, Adrian McMenamin wrote:
> But I want to do search and replace on the command line with a whole load of 
> perl files (they have hard coded passwords etc in them and I am releasing the 
> code under the GPL) without writing a perl script to do it.

Minix used to have a nice program called gres ('grep and substitute') which
solved this.

Anyway, this is what I use:

	perl -pi.bak -e 's/oldpassword/replacement/g' `find -name '*.pl'`

(Change to use xargs as appropriate).

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you.
C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes,
trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list