i have a file that contain repetitive code like this an i just want to
swap a roll/column? (how to say?) of y and z , every number is different in here nothing in here is same number
Example:
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:
Into:
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 = different numbers
sorry for poor explanation
example
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:
to
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:
his should do the job (in Notepad++):
^((?:[^,]+,){2})(\d+),((?:[^,]+,){2})(\d+)
$1$4,$3$2
Explanation:
^ : 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
Replacement:
$1$4,$3$2 : group 1 group 4 comma group 3 group 4