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!

bash scripting - list until blank line

Status
Not open for further replies.

fudge

Technical User
Jun 7, 2001
9
GB
Hi,

I'm, looking for an instruction that will allow me to search a file, grab a heading and list everything under the heading until the next blank line and/or enable me to pipe into another command.

 
Try this (untested) awk script.
Code:
{
  if ($0 == "Heading") head = 1
  if (head) {
    if ($0 == "") {
      head = 0
     }
     else {
       print
     }
  }
}
Hope this helps. CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top