[ale] Perl question
Fletch
fletch at phydeaux.org
Tue Jul 2 13:33:30 EDT 2002
>>>>> "Matthew" == Matthew Brown <matthew.brown at cordata.net> writes:
[...]
Matthew> The command I am running follows:
Matthew> $ find . -name "*.php" -maxdepth 3 | perl -p -i.bak -e
Matthew> "s/foo/bar/;"
Matthew> On my box, this simply tries to change 'foo' to 'bar' in
Matthew> the file _names_ handed to it. What am I missing?
xargs before perl.
find . -name "*.php" -maxdepth 3 | xargs perl -i.bak -pe 's/foo/bar/'
You're passing it the names of the files on its standard in.
The edit in place `-i -p' magic (or `-i -n' as well) requires the
names of the files to be passed as command line arguments, but you're
not giving it any so it defaults to working on STDIN instead (just as
<> would do in any other case).
--
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org | Vincent, you should cease askin' \ o.O'
770 933-0600 x211(w) | scary questions." -- Jules =(___)=
770 294-0820 (m) | U
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list