我建立SSH连接并阅读以下内容,但我想使用一些返回的数据。
数据:(样本1)
DSL3> 7[600C[300B[6n8show lineinfo 1-2
slot-port=1-2, DSL line info
link : link_up
service type : adsl2plus
coding mode : Concatenated (trellis and RS) coding
us interleave delay(ms) : 0 ms
ds interleave delay(ms) : 0 ms
us inp(DMT Symbol) : 0.0
ds inp(DMT Symbol) : 0.0
us output power(dBm) : 12.2
ds output power(dBm) : 18.9
country code : 00b5
provider code : 5245544b("RETK")
DSL3>
数据:(样本2)
DSL3> 7[600C[300B[6n8show lineinfo 1-3
slot-port=1-3, DSL line info
link : link_up
service type : adsl2plus
coding mode : Concatenated (trellis and RS) coding
us interleave delay(ms) : 0 ms
ds interleave delay(ms) : 0 ms
us inp(DMT Symbol) : 0.0
ds inp(DMT Symbol) : 0.0
us output power(dBm) : 12.3
ds output power(dBm) : 18.6
country code : 0026
provider code : 5443544e("TCTN")
DSL3>
数据:(样本3)
DSL3> 7[600C[300B[6n8show lineinfo 1-8
slot-port=1-8, DSL line info
link : link_down
service type : none
coding mode : No coding
us interleave delay(ms) : 0 ms
ds interleave delay(ms) : 0 ms
us inp(DMT Symbol) : 0.6
ds inp(DMT Symbol) : 0.0
us output power(dBm) : 0.0
ds output power(dBm) : 0.0
country code : N/A
provider code : N/A
DSL3>
2号线,直到3我想提取的状态如何link
,service type
,us output power(dBm)
从返回的值。
我试图用正则表达式来做,但是还没有完成。
您可以使用以下正则表达式:
link\s*:\s*(.*)|service type\s*:\s*(.*)|us output power\(dBm\)\s*:\s*(.*)
并提取link
与$1
,service type
与$2
和us output power(dBm)
带$3
。
见演示
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句