I am trying to extract multiple strings from snmp-mib files like below.
-----
$ cat IF-MIB.mib
<snip>
linkDown NOTIFICATION-TYPE
OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }
STATUS current
DESCRIPTION
"A linkDown trap signifies that the SNMP entity, acting in
an agent role, has detected that the ifOperStatus object for
one of its communication links is about to enter the down
state from some other state (but not from the notPresent
state). This other state is indicated by the included value
of ifOperStatus."
::= { snmpTraps 3 }
linkUp NOTIFICATION-TYPE
OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }
STATUS current
DESCRIPTION
"A linkUp trap signifies that the SNMP entity, acting in an
agent role, has detected that the ifOperStatus object for
one of its communication links left the down state and
transitioned into some other state (but not into the
notPresent state). This other state is indicated by the
included value of ifOperStatus."
::= { snmpTraps 4 }
<snip>
-----
I want to make a simple description summary for each items like this..
linkDown "A linkDown trap signifies that...(snip)"
linkUp "A linkUp trap signifies that.....(snip)"
Thanks a lot! It worked for my example above.
However, It failed when I tried to use this for whole IF-MIB content.(attached)
-----
[user@host MIB]$ awk '
/NOTIFICATION-TYPE/{
if(s)print s
s=sprintf("%10-s",$1)
}
f>0{
$1=$1
s=s OFS $0
}
/"/{
f--
}
/DESCRIPTION/{
f=2
}
END{
if(s)print s
}
' ./IF-MIB.mib
continue to exist after the next restart."ther they willlid: for network
of ifOperStatus."r state is indicated by the included valuercting in
END { ifCompliances 2 }quired."nor is support for the value0ing in an
[user@host MIB]
-----
My goal is to extract the description field of "NOTIFICATION-TYPE" events only, though there is some odd strings in the mib file.... Ummm:(