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

Exctracting lines from a file

Status
Not open for further replies.

Reilus

Programmer
Aug 10, 2001
7
GB
Can anyone help with this one...
I need to extract some information from a large log file. The info that I'm after is split over 3 seperate lines.
The First 2 lines are date/time stamped but the third is not and there is nothing to relate it to the other 2 lines apart from the fact it comes on the next line.

Is there an easy way to do this ?

Format is -

2002/07/18 14:36:24 od=960 ISOLATION addr=123.56.123.246
2002/07/18 14:36:24 : exception for login
Endpoint 149564235.960.508+ (hostname) orphaned endpoint.
 
You could do it with awk. How do you determine which line to star with? I assumed it was a line with od=960 in it.
Code:
awk '/od=960/ {print; getline; print; getline; print}' file
CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top