in reply to Break one liner command line script after first match

Hi

why not just exiting after printing the matched line?

UPDATE: perl -ne'/(data)/ && print($1) && exit' file.txt

McA

Replies are listed 'Best First'.
Re^2: Break one liner command line script after first match
by hdb (Monsignor) on Oct 30, 2013 at 12:33 UTC

    Or die!

    perl -ne'/(data)/ && die $1' file.txt