Grep Lines After Match

[Solved] Grep Lines After Match | Perl - Code Explorer | yomemimo.com
Question : grep lines after match

Answered by : paulo-yjl1tqmpvrf6

$ grep -A1 text
-AX tells grep to display 'X' amount of lines after line of match.
Use -BX to do the same but before.

Source : | Last Update : Wed, 06 Oct 21

Question : grep line after match

Answered by : armando-flores

Include -A flag to add lines after match and -B flag to add lines before
grep match -A 3	#display match line and 3 after lines
grep match -B 2 #display match line and 2 lines before

Source : | Last Update : Thu, 03 Dec 20

Question : grep show lines after match until other match

Answered by : ian-morales

{"tags":[{"tag":"p","content":"grep all lines until match<br>"},{"tag":"textarea","content":"#Don\u00b4t use grep, use sed:\nsed -n -e '\/Word A\/,\/Word D\/ p' file\n\n#To iterate in different files (Don\u00b4t use for loop):\nsed -n -e '\/Word A\/,\/Word D\/ p' file*","code_language":"shell"}]}

Source : | Last Update : Thu, 02 Nov 23

Question : rg display more lines

Answered by : taha-zouhair

# display 3 lines before and after matchline
rg -C 3 "keyword"

Source : | Last Update : Tue, 23 Aug 22

Answers related to grep lines after match

Code Explorer Popular Question For Perl