Re: Quit after certain paragraph



Xicheng Jia wrote:
Salve Håkedal wrote:
I want sed (or awk) to quit after the second paragraph
in response to the presence of the word 'second':


Just transfer your words into 'sed':

sed '/second/{:a;n;/^$/!ba;q;}' file.txt

Xicheng

or probably:

perl -00ne 'print if 1../second/' file.txt
awk -v RS= -v ORS="\n\n" '/second/{print; exit}1' file.txt

Xicheng

.



Relevant Pages