Welcome to WebmasterWorld Guest from 54.196.244.245

Forum Moderators: bakedjake

Message Too Old, No Replies

How to search All .php files for <?=//

Im tyring to do a server wide search for occourences of <?=//

     
8:21 pm on Jun 17, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Mar 8, 2008
posts: 44
votes: 0


I have just recently upgraded from php 4 to 5, and now have a syntax error, when i commented code after a start php echo..

All i want to do is search my /home dir for any file that has "<?=//" in it.

I thought that
grep -l -R "<?=//" /home > out.txt

would work, but it just hangs...

Any thoughts on howto accomplish this?

9:31 pm on June 17, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2547
votes: 0


Maybe it's just taking too long?

Try


find ./ -name "*.php" xargs grep "<?=//" tee out.txt

Or better yet maybe fix it all in one go with perl (back up first, use at your own risk)


find ./ -name "*.php" xargs perl -i~ -wpe 's@\<\?=//@<?php //@g'

(repeat for .inc files)

11:23 pm on June 17, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2547
votes: 0


Note that the pipe characters shown above are not actually pipes (they are changed by the WebmasterWorld software). To use the commands you need to copy and paste and then go back and put in real pipes.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members