I am working on a script to filter community entries from snmpd.confScript is:SERVER=$(hostname)touch /tmp/snmp_audit_$SERVERecho $SERVER >> /tmp/snmp_audit_$SERVERSNMP=$(cat /etc/snmp/snmpd.conf |grep -i rocommunity | awk '{print $1,$2,$3}'echo $SNMP >> /tmp/snmp_audit_$SERVERWhich gives me output in below format:rocommunity XXXX 1nn.nn.nnn.40rocommunity XXXX 1nn.nn.nnn.0/24rocommunity XXXX 1nn.nn.nnn.30However, I want to filter those servers only, which doesn't have any of the below entries in snmpd.conf:rocommunity XXXX 127.10.30.40rocommunity XXXX 192.10.30.0/24rocommunity XXXX 192.20.100.30And for all those which doesn't have these entries, later I would need to add these ranges.Also, I need to run it on multiple server over ssh, from a jump server where I have list of server names in a file.Please advice.
Bash script to filter specifc entries from snmpd.conf
shell script;text processing;snmp