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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print between two blank lines 1

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
US
I would like to search a file for "Tape_Pool_name" then print out the data between the two blank lines.....

Tape_Pool_name
Blank Line
Data
Data
Data
Data
Data
Data
Blank Line

Thanks...

Joe Despres
 
Hi
[ul]
[li]You not specified if there could be other lines between the line containing Tape_Pool_name and the first blank line. If such lines exists, this code ignores them.[/li]
[li]You not specified if a file could have more than one such sections. This code prints all of them.[/li]
[/ul]
Code:
awk '/Tape_Pool_name/{f=1}f&&!$0{f=(f+1)%3}f==2&&$0' /input/file
Tested with [tt]gawk[/tt] and [tt]mawk[/tt].

Feherke.
 
using nawk.... with your code worked!

Thanks!!!

Joe Despres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top