The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 10-04-2007
vgersh99's Avatar
vgersh99 vgersh99 is offline
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
from the top of my head - not easly and/or awk-natively, but:
Code:
/123/ {a=""}
# last
#/123/,/456/ {a=(a=="") ? $0 : a RS $0}

# first
/123/,/456/ {a=(a=="") ? $0 : a RS $0}
/456/ {exit}
END {
  print a
}
Reply With Quote