[NTLUG:Discuss] sed script
Chris Cox
cjcox at theendlessnow.com
Tue Jan 27 14:45:56 CST 2009
On Tue, 2009-01-27 at 14:37 -0600, terry wrote:
> I found and adapted a script to do a particular job, (to change one
> word in multiple files).
Like:
find . -type f -print0 | xargs -0 perl -pi -e 's/oldword/newword/g'
print0 helps with funky filenames (spaces, etc) by output a list
of names separated by the NULL character... the -0 reads a list
so separated to xargs and passes as many files as the command line
can handle to invocations of the perl command which does the inline
substitution.
More information about the Discuss
mailing list