我正在使用awk删除某些匹配的列,但是当我给变量“ Lag 1:1008:3622”时,它按预期工作,但是当我给变量“ Port 1/1 / 3.101”时,它给了我错误(^未终止的字符串)
我怀疑错误是由于正斜杠导致的,我尝试将/替换为/,[/],[/],但均无效
Dim Wb As Workbook
Set Wb = Workbooks.Open("Y:\XXX\Main.xlsm")
Application.Run "'Main.xlsm'!CreatePanelMacro"
IgnoreReadOnlyRecommended = False
Wb.Close SaveChanges:=False
n = "Lag 5:1001:3553"
d = os.popen("awk '/^ interface "+n+" create/,/^ exit$/' /home/gimec/cmip_nccm/deepak/shut_noshut/POSTCHECK/"+v).read().split('\n')
output
[' interface "Lag 5:1001:3553" create', ' exit', ' interface "Lag 5:1001:3553" create', ' description "1234567/deepak/okok/GVPN"', ' address 1.1.1.1/30', ' icmp', ' no mask-reply', ' no redirects', ' exit', ' sap lag-5:1001.3553 create', ' description "1234567/CUST/deepak"', ' ingress', ' scheduler-policy "2Mbps"', ' qos 30106', ' exit', ' egress', ' scheduler-policy "2Mbps"', ' qos 30106', ' exit', ' dist-cpu-protection "dcp-dynamic-policy-1"', ' exit', ' exit', '']
第二个变量的结果应与第一个变量相同