find / grep to list files with php's short_open_tag

Ed Greshko Ed.Greshko at greshko.com
Thu May 9 22:42:29 UTC 2013


On 05/09/13 21:05, Reindl Harald wrote:
>
> Am 09.05.2013 05:53, schrieb Patrick O'Callaghan:
>> On Tue, 2013-05-07 at 19:41 +0200, Reindl Harald wrote:
>>> find /data/www/ -type f -name \*.php -exec grep -l -i -n -F "<?" '{}' \;
>>> lists any file which contains  "<?" under the path /data/www/
>>>
>>> find /data/www/ -type f -name \*.php -exec grep -l -i -n -F "<?\n" '{}' \;
>>> is expected to find any file with "<?" followed directly by a linebreak
>>> but that does not work and if someone finds google empty it was me :-(
>> Not sure if "\n" is allowed, but why not use $ for end of line as in
>> most regular expressions?
> because it does not work and i have no idea how to "mask" the LF for grep
>
> [harry at srv-rhsoft:~]$ find /mnt/data/www/ -type f -name \*.php -exec grep -l -i -n -F "<?$" '{}' \;
> [harry at srv-rhsoft:~]$
>
> as you see nothing found
>
> [harry at srv-rhsoft:~]$ cat /mnt/data/www/short-open.php
> <?
>  echo 'TEST';
> ?>
>
> as you see there is at least one file
>

-G seems to work....  Got a splitting headache, so not thinking of the implications....

[egreshko at meimei try]$ cat one.php
<?
 echo 'TEST';
?>
[egreshko at meimei try]$ cat two.php
<?xxxx
 echo 'TEST';
?>xxxx

[egreshko at meimei try]$ find /tmp/try -type f -name \*.php -exec grep -l -i -n -G "<?$" '{}' \;
/tmp/try/one.php

-- 
The only thing worse than a poorly asked question is a cryptic answer.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130510/5e30162f/attachment.sig>


More information about the users mailing list