[SLUG] grep sed
john at johnallsopp.co.uk
john at johnallsopp.co.uk
Mon Feb 27 15:57:49 GMT 2006
Hiya
The hordes of people studying LPI with SLUG have been learning about
grep and sed this past week or so.
Co-incidentally, a client has changed their phone number, so I wanted
to run a universal search and replace, a la:
grep -l "+44 123 4567" *.php | xargs sed 's/+44 123 4567/+44 765
4321/g' | tee out.txt
What's surprised me is that that outputs the changed files, no
problem, but actually it leaves the originals intact. It doesn't save
the file changes. Obvious, I suppose, but still a surprise.
How would you move on from here folks?
J
More information about the Scarborough
mailing list