Tuesday, October 10, 2017

Grep Command with Lines

In Linux Bash shell,

> grep -B 1 -A 2 test Readme.txt

#-B number to set number lines before the match
#-A number to set number lines after the match

> grep -C 3 test Readme.txt

#-C number to set number lines before & after the match

No comments:

Post a Comment