-2

Tip #495   Print Until Regular Expression

Print a file until a regular expression is matched.
cat file.txt | perl -pe "exit if(/Last line we want/)"