1

How can I grep (or something similar) after files which has a blank line followed by <?php?

I tried without success:

grep -irn '(?<=.\r)\r<?php' *

I read in some posts that grep doesn't seem to support multiline and pcregrep should be used instead. How can I pcregrep for <?php after a blank line?

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
StandardNerd
  • 4,093
  • 9
  • 46
  • 77
  • 1
    ok, i saw in some posts that grep doesn't seem to support multiline and one should use pcregrep instead http://www.pcre.org/ . – StandardNerd Feb 27 '13 at 14:18

1 Answers1

1

The following should do what you want:

pcregrep -rinM '^\n<\?php' .
Thor
  • 45,082
  • 11
  • 119
  • 130