Quantcast
Viewing all articles
Browse latest Browse all 8

Answer by Quasímodo for Show all lines before a match

To print all lines before the match,

perl -pe 'exit if /foo/' file
awk '/foo/{exit} 1' file

Viewing all articles
Browse latest Browse all 8

Trending Articles