我在许多不同的规则规则中有数以千计这些规则
edit 1698
set src-address "172.29.44.51/32"
set dst-address "172.29.44.67/32"
set service "tcp-1022"
set service "tcp-1023"
set service "tcp-1090"
set service "tcp-1098-1102"
set service "tcp-115"
set service "tcp-123"
set service "tcp-13000"
set service "tcp-13001"
set service "tcp-14000"
set service "tcp-14001"
set service "tcp-15000"
set service "tcp-16000"
set service "tcp-1812"
set service "tcp-22"
set service "tcp-32770-32900"
set service "tcp-3307"
set service "tcp-3528"
set service "tcp-3600"
set service "tcp-4400-4500"
set service "tcp-4712-4715"
set service "tcp-5000"
set service "tcp-5000-5630"
set service "tcp-50023-50030"
set service "tcp-5632-7000"
set service "tcp-636"
set service "tcp-7500"
set service "tcp-7600"
set service "tcp-7650"
set service "tcp-7651"
set service "tcp-7900"
set service "tcp-8009"
set service "tcp-8093"
set service "tcp-8443"
set service "tcp-9000"
set service "tcp-9001"
set service "udp-1023"
set service "udp-1102"
set service "udp-123"
set service "udp-13001"
set service "udp-14000"
set service "udp-14000-14001"
set service "udp-161"
set service "udp-162"
set service "udp-177"
set service "udp-22"
set service "udp-389"
set service "udp-45600-45800"
set service "udp-5900"
set service "udp-7500"
set service "udp-8443"
set service "udp-9001"
set service "udp-920-940"
exit
我希望它将所有设置的服务行收集到一行中,就像这个例子一样
set service "PING" "tcp-1022" "tcp-1023" "tcp-1090" "tcp-1098-1102" "tcp-115" "tcp-123" "tcp-13000" "tcp-13001" "tcp-14000" "tcp-14001" "tcp-15000" "tcp-16000" "tcp-1812" "tcp-22" "tcp-32770-32900" "tcp-3307" "tcp-3528" "tcp-3600" "tcp-4400-4500" "tcp-4712-4715" "tcp-5000" "tcp-5000-5630" "tcp-50023-50030" "tcp-5632-7000" "tcp-636" "tcp-7500" "tcp-7600" "tcp-7650" "tcp-7651" "tcp-7900" "tcp-8009" "tcp-8093" "tcp-8443" "tcp-9000" "tcp-9001" "udp-1023" "udp-1102" "udp-123" "udp-13001" "udp-14000" "udp-14000-14001" "udp-161" "udp-162" "udp-177" "udp-22" "udp-389" "udp-45600-45800" "udp-5900" "udp-7500" "udp-8443" "udp-9001" "udp-920-940"
答案 0 :(得分:0)
这是一个仅限记事本的++解决方案。它使用的是宏,因为你说你有许多不同的规则文件。
^(?!set service).+?\r\nset service
\1first set service\3
检查左下角的正则表达式 \r\nset service
^first set service
set service
检查左下角的正则表达式 现在您可以打开所有规则文件并将宏应用于每个文件。 如果您需要删除宏,可以在Macro下找到它 - >修改快捷方式/删除宏。
修改:这是一个屏幕截图,用于调试您在评论中写下的零匹配问题:,请注意标记的部分:
\r\n
必须修改行数:
建议的搜索结果Regex :