|
grep -n lines before and after
Hi,
is it possible to grep a pattern that will include the "n" lines before and after the line where the pattern have been found?
e.g.
#this contains the test.file
line1
line2
line3
line4
line5
then a grep command to search the word "line3"
and the output should be 1 (or n) line before that line and 1 (or n) line "after" that line.
dessired output of the grep command
line2
line3
line4
Thanks in advance.
|