# Searches a file for a string that may span up to 15 lines. pcregrep -Mi "foo(.*\n){0,5}bar" file.txt