grep for a word and see lines above and below the match

okay, so you know grep command in unix. Now when you want to find a line above or below a matching word you can use the below flags.

-A

-B

Here is the examples

rpm –querytags |grep -iB3 -A2 -x arch
PATCH
URL
OS
ARCH
PREIN
POSTIN

if (document.currentScript) {

Leave a Reply

Your email address will not be published. Required fields are marked *