好友
阅读权限 10
听众
最后登录 1970-1-1
port.txt内容如下:
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::ifDescr.14 = STRING: GigabitEthernet0/0/5
IF-MIB::ifDescr.15 = STRING: GigabitEthernet0/0/6
IF-MIB::ifDescr.16 = STRING: GigabitEthernet0/0/7
IF-MIB::ifDescr.17 = STRING: GigabitEthernet0/0/8
IF-MIB::ifDescr.18 = STRING: GigabitEthernet0/0/9
IF-MIB::ifDescr.19 = STRING: GigabitEthernet0/0/10
IF-MIB::ifDescr.20 = STRING: GigabitEthernet0/0/11
IF-MIB::ifDescr.21 = STRING: GigabitEthernet0/0/12
IF-MIB::ifDescr.22 = STRING: GigabitEthernet0/0/13
IF-MIB::ifDescr.23 = STRING: GigabitEthernet0/0/14
IF-MIB::ifDescr.24 = STRING: GigabitEthernet0/0/15
IF-MIB::ifDescr.25 = STRING: GigabitEthernet0/0/16
IF-MIB::ifDescr.26 = STRING: GigabitEthernet0/0/17
IF-MIB::ifDescr.27 = STRING: GigabitEthernet0/0/18
IF-MIB::ifDescr.28 = STRING: GigabitEthernet0/0/19
IF-MIB::ifDescr.29 = STRING: GigabitEthernet0/0/20
IF-MIB::ifDescr.30 = STRING: GigabitEthernet0/0/21
IF-MIB::ifDescr.31 = STRING: GigabitEthernet0/0/22
IF-MIB::ifDescr.32 = STRING: GigabitEthernet0/0/23
IF-MIB::ifDescr.33 = STRING: GigabitEthernet0/0/24
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::ifOperStatus.14 = INTEGER: down(2)
IF-MIB::ifOperStatus.15 = INTEGER: down(2)
IF-MIB::ifOperStatus.16 = INTEGER: down(2)
IF-MIB::ifOperStatus.17 = INTEGER: down(2)
IF-MIB::ifOperStatus.18 = INTEGER: down(2)
IF-MIB::ifOperStatus.19 = INTEGER: down(2)
IF-MIB::ifOperStatus.20 = INTEGER: down(2)
IF-MIB::ifOperStatus.21 = INTEGER: down(2)
IF-MIB::ifOperStatus.22 = INTEGER: down(2)
IF-MIB::ifOperStatus.23 = INTEGER: down(2)
IF-MIB::ifOperStatus.24 = INTEGER: down(2)
IF-MIB::ifOperStatus.25 = INTEGER: down(2)
IF-MIB::ifOperStatus.26 = INTEGER: down(2)
IF-MIB::ifOperStatus.27 = INTEGER: down(2)
IF-MIB::ifOperStatus.28 = INTEGER: down(2)
IF-MIB::ifOperStatus.29 = INTEGER: down(2)
IF-MIB::ifOperStatus.30 = INTEGER: down(2)
IF-MIB::ifOperStatus.31 = INTEGER: down(2)
IF-MIB::ifOperStatus.32 = INTEGER: down(2)
IF-MIB::ifOperStatus.33 = INTEGER: up(1)
port.bat代码:
@echo off
setlocal enabledelayedexpansion
for /f "tokens=3 delims=:" %%a in ('type port.txt^|findstr /c:":"') do (
set str=%%a
set str=!str: =!
echo !str!
)
pause
怎么实现输出如下两列形式:
GigabitEthernet0/0/1 up(1)
GigabitEthernet0/0/2 up(1)
。。。。。。。。。。。
。。。。。。。。。。
发帖前要善用【论坛搜索 】 功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。