Hi
I'm wanting to mod some PHP files across a hierarchy and thought I'd drive it with find + grep + xargs
I built up a command line which I was confident would do the job, but now can't save the results.
First I tried this:
Code:
find . -name \*.php | xargs grep serialize | cut -d: -f1| sort -u | xargs sed -i s/serialize/serialise/g
but that didn't work:
Code:
sed: illegal option -- i
so I thought I'd try using
so that I could repeat the file name
but I'm having trouble with this. For instance
Code:
find . -name \*.php | xargs grep serialize | cut -d: -f1| sort -u | xargs -I{} sed s/serialize/serialise/g {} > {}.old
just writes a single file with the name {}.old containing all the other files
while
Code:
find . -name \*.php | xargs grep serialize |cut -d: -f1|sort -u | xargs -I{} echo {} {}.alt
produces:
Code:
./includes/authenticate.php ./includes/authenticate.php.alt
./modules/team/modify.php ./modules/team/modify.php.alt
./modules/team/modifyInfo.php ./modules/team/modifyInfo.php.alt
so, I'm clearly missing something ... perhaps something obvious.
can anyone assist with this?