Answers for "how to print next lines with grep"

0

how to print next lines with grep

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
Posted by: Guest on October-03-2021
0

how to print next lines with grep

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
Posted by: Guest on October-03-2021
0

how to print next lines with grep

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
Posted by: Guest on October-03-2021
0

print next 10 lines after grep

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
Posted by: Guest on October-03-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language