How can I make grep print the lines below and above each matching line? [duplicate]
How can I make grep print the lines below and above each matching line? [duplicate] linux
linux
grep's -A 1 option will give you one line after; -B 1 will give you one line before; and -C 1 combines both to give you one line both before and after, -1 does the same.
grep --help...-B, --before-context=NUM print NUM lines of leading context-A, --after-context=NUM print NUM lines of trailing context-C, --context=NUM print NUM lines of output context-NUM same as --context=NUM...