Search notes:

awk example: print range

Two regular expressions, sparated by a comma, can be used to specify the first and last line of the input stream that need to be printed.
Note, the following example also prints the empty line that signals the end of the paragraph:
$ echo 'foo
bar
baz

FIRST LINE OF PARAGRAPH
one
two
three

hello
world' | awk '/^FIRST LINE/,/^$/'
FIRST LINE OF PARAGRAPH
one
two
three

See also

awk examples

Index