Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print section of file between two regular expressions (inclusive)

Status
Not open for further replies.

viadisky

Technical User
Jun 19, 2003
110
GB
I saw this from one of the awk one-liner examples. This will print a section of the file between these two regular expressions Iowa and Montana.

awk '/Iowa/,/Montana/'

How can I modify this to tell awk to start showing lines from Iowa up to the first blank line it will see?

awk '/Iowa/,/<1st blank line>/'

Definitely I can't use " " or "/n" because it will only print the line with Iowa and the next line to this.

Sorry if this is very basic question.
 

Sorry for unnecessary posting my query, I realised now that I need this awk command.

awk '/Iowa/,/^$/'

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top