$ cat input.txt one two three four five six seven $ perl -ne 'print $_ = <> and last if /five/' input.txt six