Quantcast
Channel: Show all lines before a match - Ask Ubuntu
Viewing all articles
Browse latest Browse all 8

Answer by Cyrus for Show all lines before a match

$
0
0

With GNU sed. Print all lines, from the first to the line with the required string.

sed '0,/foo/!d' file

Viewing all articles
Browse latest Browse all 8

Trending Articles