回复 5# qiulai
将:- IF-MIB::ifDescr.10 = STRING: GigabitEthernet0/0/1
- IF-MIB::ifDescr.11 = STRING: GigabitEthernet0/0/2
- IF-MIB::ifDescr.12 = STRING: GigabitEthernet0/0/3
- IF-MIB::ifDescr.13 = STRING: GigabitEthernet0/0/4
- IF-MIB::ifOperStatus.10 = INTEGER: up(1)
- IF-MIB::ifOperStatus.11 = INTEGER: up(1)
- IF-MIB::ifOperStatus.12 = INTEGER: up(1)
- IF-MIB::ifOperStatus.13 = INTEGER: down(2)
- IF-MIB::ifPhysAddress.10 = STRING: 4c:1f:cc:98:7b:64
- IF-MIB::ifPhysAddress.11 = STRING: 4c:1f:cc:98:7b:64
- IF-MIB::ifPhysAddress.12 = STRING: 4c:1f:cc:98:7b:64
- IF-MIB::ifPhysAddress.13 = STRING: 4c:1f:cc:98:7b:64
复制代码 以ANSI编码格式保存为port.txt
下载gawk( http://bcn.bathome.net/tool/4.1.0/gawk.exe )
执行:- gawk -F"\\.|::| = |: " "!($2 in a){a[$2];b[++N]=$2}!($3 in a){a[$3];c[++n]=$3}{d[$2,$3]=$5}END{for(i=0;i++<n;){for(j=0;j++<N;){printf\"%s \",d[b[j],c[i]]}print\"\"}}" port.txt>out.txt
复制代码 结果(out.txt):- GigabitEthernet0/0/1 up(1) 4c:1f:cc:98:7b:64
- GigabitEthernet0/0/2 up(1) 4c:1f:cc:98:7b:64
- GigabitEthernet0/0/3 up(1) 4c:1f:cc:98:7b:64
- GigabitEthernet0/0/4 down(2) 4c:1f:cc:98:7b:64
复制代码
|