jeffg2235
IS-IT--Management
- Jul 25, 2008
- 3
I am a beginner with awk, trying to create a snmp script that will pull data from each snmp MIB which is dumped to a file. iam printing column 4 from each file which has relevant data.
what i am trying to achieve is this:
examples below
file1
10.1.1.1
10.2.2.2
file2
app1
app2
output desired:
10.1.1.1 app1
10.2.2.2 app2
#!/bin/bash
server=x.x.x.x
community=yyyyyy
/usr/bin/snmpwalk -c $community -v 1 $server .1.3.6.1.4.1.1991.1.1.4.2.1.1.2 > product
/usr/bin/snmpwalk -c $community -v 1 $server .1.3.6.1.4.1.1991.1.1.4.2.1.1.3 > ips
awk -F"," '{ print $4 }' product > products && awk -F"," '{ print $4 }' ips > ip1
paste products ips | awk -F, '{ printf("%-20s%-20s\n",$1,$2 )}'
what i am trying to achieve is this:
examples below
file1
10.1.1.1
10.2.2.2
file2
app1
app2
output desired:
10.1.1.1 app1
10.2.2.2 app2
#!/bin/bash
server=x.x.x.x
community=yyyyyy
/usr/bin/snmpwalk -c $community -v 1 $server .1.3.6.1.4.1.1991.1.1.4.2.1.1.2 > product
/usr/bin/snmpwalk -c $community -v 1 $server .1.3.6.1.4.1.1991.1.1.4.2.1.1.3 > ips
awk -F"," '{ print $4 }' product > products && awk -F"," '{ print $4 }' ips > ip1
paste products ips | awk -F, '{ printf("%-20s%-20s\n",$1,$2 )}'