-1

I have a bunch of files, and I'm trying to find the ones that contain the string "EXECUTION FAILED" and also display the previous 10 lines prior to the "EXECUTION FAILED". I am wondering how I can do this?

David
  • 163

1 Answers1

1

With :

grep -B10 'EXECUTION FAILED' files*

From

LESS=+/'^ +-B' man grep

-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.