samedi 9 mai 2015

Print subset of file from line number to first match of regex using sed

I would like to print the content of a file starting a particular line number till the first occurrence of a pattern and immediately stop the search & print. I tried this one:

sed -n '2,/{p; :loop n; p; /pattern/q; b loop}'

but without success. How can this be achieved? Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire