On Wed, May 08, 2013 at 11:23:34PM -0430, Patrick O'Callaghan wrote:
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 "<?\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?
Reindl is using fgrep (implied by the -F flag), so I would think \n is
interpreted literally. I would agree with your suggestion to use
$ grep -E "<?$"
Another recommendation would be to use -print0 and pipe to xargs -0.
Using the -exec flag for something like this might be significantly less
efficient.
--
Suvayu
Open source is the future. It sets us free.