Is there a command in Mac OS X that can perform multiline regex searching?

Install Homebrew and then:

brew install pcre

This will give you the latest pcregrep


You didn't say exactly what you're looking for so I'll imagine the task to find out whether the file contains 112 followed by 223, disregarding newlines.

A slightly contrived awk solution:

awk -vRS='' '/112.*223/ { print "found it"; exit }' file.in

The RS variable contains the record separator. By setting it to the empty string, the whole file will be read as one record.

This will probably be very memory inefficient on large files.

By the way, I'm doing this on OpenBSD, but the OS X awk ought to work the same way.