我有一个包含重复代码的文件,我只想
交换卷/列? (怎么说?)的y和z,每个数字都不同,这里没有什么,这里是相同的数字
示例:
xxxx,xxxx,yyyy,xxxx,xxxx,zzzz:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,yyyy,xxxx,xxxx,zzzz:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,yyyy,xxxx,xxxx,zzzz:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,yyyy,xxxx,xxxx,zzzz:xxxx:xxxx:xxxx:xxxx:
分为:
xxxx,xxxx,zzzz,xxxx,xxxx,yyyy:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,zzzz,xxxx,xxxx,yyyy:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,zzzz,xxxx,xxxx,yyyy:xxxx:xxxx:xxxx:xxxx:
xxxx,xxxx,zzzz,xxxx,xxxx,yyyy:xxxx:xxxx:xxxx:xxxx:
x,y,z =不同的数字
对不起解释不好
例如
36,192,72004,128,0,71923:0:0:0:0:
256,192,72014,128,0,71843:0:0:0:0:
475,192,72204,128,0,71923:0:0:0:0:
到
36,192,71923,128,0,72004:0:0:0:0:
256,192,71843,128,0,72014:0:0:0:0:
475,192,71923,128,0,72204:0:0:0:0:
答案 0 :(得分:1)
他应该做的工作(在Notepad ++中):
^((?:[^,]+,){2})(\d+),((?:[^,]+,){2})(\d+)
$1$4,$3$2
<强>解释强>
^ : start of line
( : start group 1
(?: : start non capture group
[^,]+ : 1 or more non comma
, : a comma
){2} : end group, must appear twice
) : end group 1
(\d+) : group 2, 1 or more digits
, : a comma
( : start group 3
(?: : start non capture group
[^,]+ : 1 or more non comma
, : a comma
){2} : end group, must appear twice
) : end group 3
(\d+) : group 4, 1 or more digits
<强>替换强>
$1$4,$3$2 : group 1 group 4 comma group 3 group 4