【发布时间】:2018-06-14 03:43:05
【问题描述】:
我需要一个可以从 cisco 配置文本文件中提取 line vty 0 4 部分的脚本。谁能推荐一种使用 powershell/regex 的方法?
ex:我需要以下块测试拉取并输出到文件,或者只是屏幕输出。
line con 0
exec-timeout 10 0
timeout login response 30
privilege level 1
special-character-bits 7
exec
line vty 0 4 >STARING AT THIS LINE
access-class VTY-ACL in
motd-banner
exec-banner
exec-timeout 10 0
timeout login response 30
privilege level 1
logging synchronous >ENDING AT THIS LINE
line vty 5 15
access-class VTY-ACL in
motd-banner
exec-banner
exec-timeout 10 0
timeout login response 30
privilege level 1
logging synchronous
【问题讨论】:
-
这当然可以在powershell中完成。您应该从
Get-Contentcmdlet 开始,然后在网络上搜索众多这样做的人之一。然后写一些代码,当你写的代码有具体问题时在这里问。
标签: regex powershell