Notepad++ 脚本还是使用正则表达式进行排序?

huangapple go评论59阅读模式
英文:

Notepad ++ Script or sort with RegEx?

问题

xxxx.98ff.6264,DRC-BOH,PT_33_52,DCA_Campus_Site_Tag,DLR-Indoor_rf_tag
xxxx.21a1.829c,DRC-BOH,PT_33_53,DCA_Campus_Site_Tag,DLR-Indoor_rf_tag
xxxx.c82a.3a10,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.8b62.527c,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.7a97.afe4,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.7ad9.8f88,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2d9d.ffe8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.806e.dd50,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.9cd9.7890,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.781e.84d6,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.785a.bf9e,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.9844.0a84,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.987b.9ec4,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2f86.d7cc,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2fb1.4528,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.396a.0b6a,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.d69f.c234,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.5dd7.bbe8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.5ded.2858,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.1dd6.33b8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.8835.11ac,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.47df.9fee,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
rest with same pattern...........
英文:

I have data like this :

Location Name......................: DRC-BOH
Location description...............: DRC-BOH-locationinfo
Policy tag.........................: PT_33_52
Site tag...........................: DCA_Campus_Site_Tag
RF tag.............................: DLR-Indoor_rf_tag
Configured list of APs
xxxx.98ff.6264   
xxxx.21a1.829c   
Location Name......................: DL-cb
Location description...............: DL-cb-locationinfo
Policy tag.........................: PT_23_26_52
Site tag...........................: DL_Campus_1_Site_Tag
RF tag.............................: DLR-Indoor_rf_tag
Configured list of APs
xxxx.c82a.3a10   
xxxx.8b62.527c   
xxxx.7a97.afe4   
xxxx.7ad9.8f88   
xxxx.2d9d.ffe8   
xxxx.806e.dd50   
xxxx.9cd9.7890   
xxxx.781e.84d6   
xxxx.785a.bf9e   
xxxx.9844.0a84   
xxxx.987b.9ec4   
xxxx.2f86.d7cc   
xxxx.2fb1.4528   
xxxx.396a.0b6a   
xxxx.d69f.c234   
xxxx.5dd7.bbe8   
xxxx.5ded.2858   
xxxx.1dd6.33b8   
xxxx.8835.11ac   
xxxx.47df.9fee   

 more of the same....

I need to have this in the end...:

xxxx.98ff.6264,DRC-BOH,PT_33_52,DCA_Campus_Site_Tag,DLR-Indoor_rf_tag
xxxx.21a1.829c,DRC-BOH,PT_33_53,DCA_Campus_Site_Tag,DLR-Indoor_rf_tag
xxxx.c82a.3a10,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.8b62.527c,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.7a97.afe4,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.7ad9.8f88,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2d9d.ffe8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.806e.dd50,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.9cd9.7890,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.781e.84d6,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.785a.bf9e,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.9844.0a84,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.987b.9ec4,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2f86.d7cc,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.2fb1.4528,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.396a.0b6a,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.d69f.c234,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.5dd7.bbe8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.5ded.2858,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.1dd6.33b8,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.8835.11ac,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
xxxx.47df.9fee,DL-cb,PT_23_26_52,DL_Campus_1_Site_Tag,DLR-Indoor_rf_tag
rest with same pattern...........

I think this will be multiple steps. I am very new to notepad++ but want to learn more about regex and notepad ++ sorting. Any help would be appreciated.

I have been doing it manually by cutting the "configured list of APs" out and using crtl+alt, then pasting each field while adding commmas . There are more than 2500 Aps so i keep thinking there is a better way.

答案1

得分: 1

Replace the following code:

Location Name......................: (.+)
Location description...............: (.+)
Policy tag.........................: (.+)
Site tag...........................: (.+)
RF tag.............................: (.+)
Configured list of APs
(?:.{4}\.*
)*?.{4}\..{4}\..{4}(?=\s*\n)

with:

$0,$1,$3,$4,$5

无论需要多少次。

英文:

See https://regex101.com/r/p6SWd6/1 (code below)

Replace

Location Name......................: (.+)
Location description...............: (.+)
Policy tag.........................: (.+)
Site tag...........................: (.+)
RF tag.............................: (.+)
Configured list of APs
(?:.{4}\.*
)*?.{4}\..{4}\..{4}(?=\s*\n)

with

$0,$1,$3,$4,$5

however many times you need

huangapple
  • 本文由 发表于 2023年3月31日 23:44:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75900413.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定