如何从ipconfig中提取特定的接口数据?

时间:2014-01-02 13:18:34

标签: grep ipconfig

我正在尝试在ipconfig / all中为特定接口提供所有数据。

我不能使用netssh或任何其他程序。

我可以使用grep(对于windows - 但只有grep,而不是mgrep pcgrep或其他),sed(同样的东西......)或者当然是findtr。

你能想出办法吗?

我想获取“SLOT 2 3”的所有数据,并丢失所有其他数据。

这是输出的样子:

Windows IP配置

   Host Name . . . . . . . . . . . . : l-075
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : wininstall.what.com

以太网适配器SLOT 2 3:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::202:c9ff:feb5:94e1%24(Preferred)
   IPv4 Address. . . . . . . . . . . : 12.0.0.33(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Thursday, January 2, 2014 12:26:18 PM
   Lease Expires . . . . . . . . . . : Friday, January 10, 2014 12:26:18 PM
   Default Gateway . . . . . . . . . :
   DHCP Server . . . . . . . . . . . : 12.0.0.83
   DHCPv6 IAID . . . . . . . . . . . : 436208329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-25-9E-19-D4-AE-52-A1-37-E7
   DNS Servers . . . . . . . . . . . : 10.4.0.0
                                       10.4.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

以太网适配器SLOT 2 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E0
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

以太网适配器NIC4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #4
   Physical Address. . . . . . . . . : D4-AE-52-A1-37-EA
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

这就是我需要的:

以太网适配器SLOT 2 3:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::202:c9ff:feb5:94e1%24(Preferred)
   IPv4 Address. . . . . . . . . . . : 12.0.0.33(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Thursday, January 2, 2014 12:26:18 PM
   Lease Expires . . . . . . . . . . : Friday, January 10, 2014 12:26:18 PM
   Default Gateway . . . . . . . . . :
   DHCP Server . . . . . . . . . . . : 12.0.0.83
   DHCPv6 IAID . . . . . . . . . . . : 436208329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-25-9E-19-D4-AE-52-A1-37-E7
   DNS Servers . . . . . . . . . . . : 10.4.0.0
                                       10.4.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

0 个答案:

没有答案