2

Tip #818   Print first line of every paragraph

The awk command below will print out the first line of each paragraph in a file. Paragraphs must be separated by a blank line for this to work.

awk 'NR==1||cnt-->0;/^$/{cnt=1}' file.txt