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

how to print line mathing a pattern and line immediately above it 2

Status
Not open for further replies.

jdhahbi

Technical User
Oct 7, 2009
24
US
Hi
how to print line matching a pattern and line immediately above it?
thanks
joseph
 
Something like this ?
Code:
awk '/pattern/{print x"\n"$0}{x=$0}' /path/to/input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top