With the grep
command, I found the text I need as follows:
grep 'C02' ~/temp/log.txt
Now, wherever I find the desired string, I would like to print the line following the found string.
For example, let's say that the desired text is abc
, and abc
is found on line 12, I would like to print line 13 too.
grep -A1 'abc' ~/temp/log.txt
for 1 line of context After the match - see theContext Line Control
subsection of the manual (man grep
) – steeldriver Nov 03 '16 at 00:44grep -F 'C02'
instead as it is faster.grep -F
matches fixed strings. such as 'C02' – Cadoiz Nov 02 '21 at 16:52