这是snmpwalk
的输出:
snmpwalk -c public -v2c localhost .1.3.6.1.2.1.2
IF-MIB::ifNumber.0 = INTEGER: 5
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4
IF-MIB::ifIndex.5 = INTEGER: 5
IF-MIB::ifDescr.1 = STRING: gbeth0
IF-MIB::ifDescr.2 = STRING: gbeth1
IF-MIB::ifDescr.3 = STRING: gbeth2
IF-MIB::ifDescr.4 = STRING: gbeth3
IF-MIB::ifDescr.5 = STRING: defloopback
运行snmpwalk时,我想删除ifIndex.5。
我应该怎么办?
答案 0 :(得分:0)
您可以执行以下操作逐行处理输出(Linux shell):
snmpwalk -c public -v2c localhost .1.3.6.1.2.1.2 | sed 1d | \
while read i
do
if [[ $i != *"5"* ]]; then
echo $i
fi
done