Grepmod

Grepmod is a modification of the Linux command grep. Instead of returning a pattern, it returns the pattern plus any number of lines before and after the pattern.


$ grepmod

Usage : /usr/bin/grepmod -f <file> -m <patterns> -i <lines infront> -b <lines behind>

$ cat test.txt

first

second

third

fourth

fifth

sixth

seventh

$ grepmod -f test.txt -m third -i 1 -b 1

Pattern: 3 third


Prepended:

2 second


Appended:

4 fourth