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

locating and extracting data from a file

Status
Not open for further replies.

alfie002

Technical User
Mar 3, 2004
121
GB
hello all,

I have a file with the following format;

EVENT OV_IF_Index_Remapped .1.3.6.1.4.1.11.2.17.1.0.58982417 "Configuration Alarms" Major
FORMAT Possible device reconfiguration. Interface to IfIndex have been remapped. You may need to reconfigure any data collection on $2. The new interface mappings are:\n$5
EXEC OVHIDESHELL ovIfIndexRemap.ovpl
DISPLAY Possible device reconfiguration. Interface to IfIndex have been remapped. You may need to reconfigure any data collection on $2. The new interface mappings are:\n$5
SDESC

In my case, where there is an occurrence of the "EVENT" parameter and an occurrence of the EXEC parameter, I want to be able to extract the line starting with the EVENT test and also the line starting with the EXEC text.

Locating the EVENT is not a problem, but I am unsure to how then check for the EXEC string and then write both to a text file.

Any help would be appreciated.

Thanks


Alf
 
You wanted this ?
awk '/^(EVENT|EXEC) /' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top