Display the output of a command from the first line until the first instance of a regular expression.

\"Screenshot
Image via Wikipedia

| perl -n -e \'print \"$_\" if 1 ... /<regex>/;# This command line will display the output of , from the first line of output, until the first time it sees a pattern matching .

You could specify the regex pattern /^$/ to look for the first blank line,

or /^foobar/ to look for the first line that starts with the word foobar.

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/Ie99mgx_Pfw/display-the-output-of-a-command-from-the-first-line-until-the-first-instance-of-a-regular-expression.

There are couple of other ways you can do so, like using sed, awk.

<command> |sed –quiet \’/svn_/,$ !p\’

\"Reblog