Print Next 10 Lines After Grep

[Solved] Print Next 10 Lines After Grep | Perl - Code Explorer | yomemimo.com
Question : how to print next lines with grep

Answered by : kirkpatrick-brown

grep -A 2 "searchText" mytext.txt ## next 2 lines after match line
grep -B 2 "seacrchText" mytext.txt ## next 2 lines before match line
grep -C 2 "searchText" mytext.txt ## next 2 lines before and after match line

Source : | Last Update : Sun, 10 Oct 21

Question : print next 10 lines after grep

Answered by : kirkpatrick-brown

grep -A 2 "app" mytext.txt //prints two lines after the match line
grep -B 2 "app" mytext.txt //prints two lines before the match line

Source : | Last Update : Sun, 10 Oct 21

Answers related to print next 10 lines after grep

Code Explorer Popular Question For Perl