示例数据:
"107","34.813080","117.195.184.97","10.1.10.46","UDP","366","Source port: 3867 Destination port: 52000"
"110","34.832201","10.1.10.46","117.195.184.97","UDP","1022","Source port: 52000 Destination port: 3867"
"112","35.155310","10.1.10.46","117.195.184.97","UDP","974","Source port: 52000 Destination port: 3867"
从记事本++我怎么能删除除此之外的所有数据:
117.195.184.97
10.1.10.46
10.1.10.46
并按原样格式化:
date:117.195.184.97-117.195.184.97
date:117.195.1xx.xxx-117.195.1xx.xxx
这对我的工作非常有帮助,notepad ++已经有一个过滤器来删除重复的行,所以一旦它们被过滤掉,我就可以轻松删除重复项。
答案 0 :(得分:1)
如果您的行总是使用相同的格式,并且您想要的字段始终是第三个,则可以使用:
搜索:^.*?",".*?","(.*?)".*
替换:date:$1-$1
细节:
^ # start of the line
.*?"," # all until the first ","
.*?"," # all until the second ","
(.*?)" # capture in group 1 until the next "
.* # all until the end of the line
答案 1 :(得分:0)
诀窍是搜索非逗号"。干得好:
搜索:
^.[^,]*,[^,]*,"([^,]*\.[^,]*\.[^,]*\.[^,]*)".*
并替换为
$1
-Ed