Hi,
I would like to see if it is possible to process the output of a grep in this way.
sample command: command | grep -B4 "search string found on line 5"
Sample input from stdout:
(Line 1) Random #
Line 2
Line 3
Line 4
Line 5
I've been reading man pages/searching/googling for a way to grab only line 1 from the output using awk, grep, sed or xargs. (or something else).
If possible, is there a way to grab line1 based on the number or if line 1 was text, then just grab line 1 off of the match?
I would like to see if it is possible to process the output of a grep in this way.
sample command: command | grep -B4 "search string found on line 5"
Sample input from stdout:
(Line 1) Random #
Line 2
Line 3
Line 4
Line 5
I've been reading man pages/searching/googling for a way to grab only line 1 from the output using awk, grep, sed or xargs. (or something else).
If possible, is there a way to grab line1 based on the number or if line 1 was text, then just grab line 1 off of the match?