This is the control File (snmplist.fl1)
.1.3.6.1.4.1.789.1.5.4.1.2.3 = STRING: "/vol/vol0/"
.1.3.6.1.4.1.789.1.5.4.1.2.5 = STRING: "/vol/SMP_sapdata/"
.1.3.6.1.4.1.789.1.5.4.1.2.7 = STRING: "/vol/SMP_saplog/"
.1.3.6.1.4.1.789.1.5.4.1.2.9 = STRING: "/vol/SRP_saplog/"
.1.3.6.1.4.1.789.1.5.4.1.2.11 = STRING: "/vol/SRP_sapdata/"
while read line; do VOL=`awk 'BEGIN { FS="[. ]" } {print $14}' snmplist.fl1`; OID=`awk 'BEGIN { FS="[. ]" } {print $17}' snmplist.fl1`; echo echo -e "<31>\n active = 1\n name = DF Percent Free $VOL \n oid = .1.3.6.1.4.1.789.1.5.4.1.6.$OID\n thr = 10\n oper =>=\n sev = 4\n strnum = 0\n</31>" ; done < snmplist.fl1
trying to get the last octet of each snmp line, and the "Vol Name"
and echo those two peices of data into a new line via the echo command
not happening,
would appreciate a hand,
thanx
ripat
October 1, 2009, 3:27am
2
Can you provide required output?
output should look like this
<31>
active = 1
name = DF Percent Free $VOL
oid = .1.3.6.1.4.1.789.1.5.4.1.6.$OID
thr = 10
oper =>=
sev = 4
strnum = 0
</31>
where $VOL and $OID are is where the data should go.
ripat
October 1, 2009, 3:43am
4
Is it this that you are after?
awk -F"[ .]" -v fmt="<31>\nactive = 1\nname = DF Percent Free %s\noid = .1.3.6.1.4.1.789.1.5.4.1.6.%s\nthr = 10\noper =>=\nsev = 4\nstrnum = 0\n</31>\n" '{printf fmt,$14,$17}' snmplist.fl1
no sir
the other way around
your output states
<31>
active = 1
name = DF Percent Free 11
oid = .1.3.6.1.4.1.789.1.5.4.1.6."/vol/SRP_sapdata/"
thr = 10
oper =>=
sev = 4
strnum = 0
</31>
need
<31>
active = 1
name = DF Percent Free "/vol/SRP_sapdata/"
oid = .1.3.6.1.4.1.789.1.5.4.1.6.11
thr = 10
oper =>=
sev = 4
strnum = 0
</31>
---------- Post updated at 02:48 AM ---------- Previous update was at 02:45 AM ----------
awk -F"[ .]" -v fmt="<31>\nactive = 1\nname = DF Percent Free %s\noid = .1.3.6.1.4.1.789.1.5.4.1.6.%s\nthr = 10\noper =>=\nsev = 4\nstrnum = 0\n</31>\n" '{printf fmt,$17,$14}' snmplist.fl1
is the correct one