need help for batch editing
-
Hello, i’d like to edit a number that is located in a particular position in a text. i’d like to edit the number located after the first 2 commas in the text below
below you can see lines that correspond to objects carateristics in a game. i’d like to edit in a row the number that is in number 2000 position. i know i could use in that particular case the search and replace option. but in some cases that number doesn’t correspond to 2000, but to another number. so i’d like to edit the number located in each line after the first 2 commas. is this possibleplage, plage, 2000, 12582912, 0, 275.112, 43.6829, 0.57576, 1568.3, 1491.7, 29.7886, 921.708, 767.69, 15.1822, 970.818, null
plage0, plage, 2000, 12582912, 0, -470.48, -690.498, -16.542, 470.48, 690.498, 16.542, 0.0, 0.00012207, 4.76837e-007, 835.711, null
plage1, plage, 2000, 12582912, 0, -456.201, -769.794, -15.5455, 456.201, 769.794, 15.5455, 0.0, 0.0, -4.76837e-007, 894.955, null
plage2, plage, 2000, 12582912, 0, -788.48, -1012.48, -16.8566, 788.48, 1012.48, 16.8566, 0.0, 0.0, -4.76837e-007, 1283.39, null
plage3, plage, 2000, 12582912, 0, -716.8, -680.96, -16.7993, 716.8, 680.96, 16.7993, 0.0, 0.0, 0.0, 988.833, null
plage4, plage, 2000, 12582912, 0, -788.48, -430.08, -17.4505, 788.48, 430.08, 17.4505, 0.0, -0.000244141, 4.76837e-007, 898.317, null
plage5, plage, 2000, 12582912, 0, -788.48, -286.72, -16.8566, 788.48, 286.72, 16.8566, 0.0, 0.0, -4.76837e-007, 839.162, null
plage6, plage, 2000, 12582912, 0, -788.48, -756.566, -16.8566, 788.48, 756.565, 16.8566, 0.0, 0.0, -4.76837e-007, 1092.88, null
plage7, plage, 2000, 12582912, 0, -415.092, -669.848, -2.35125, 415.092, 669.848, 2.35125, 0.0, 0.0, 0.0, 788.038, null
plage8, plage, 2000, 12582912, 0, -323.538, -698.055, -1.83764, 323.538, 698.055, 1.83764, 0.0, 0.0, 0.0, 769.39, null
plage9, plage, 2000, 12582912, 0, -344.821, -653.995, -2.31168, 344.821, 653.995, 2.31168, 0.0, 0.0, 0.0, 739.335, null
plage10, plage, 2000, 12582912, 0, -414.529, -697.8, -3.58363, 414.53, 697.8, 3.58363, 0.0, 0.00012207, 0.0, 811.648, null
plage11, plage, 2000, 12582912, 0, -429.283, -679.338, -4.19869, 429.282, 679.338, 4.1987, 0.0, 0.0, 0.0, 803.618, null
plage12, plage, 2000, 12582912, 0, -650.986, -725.165, -29.6797, 650.987, 725.165, 29.6797, 0.0, 0.0, -9.53674e-007, 974.951, null -
Hello Mambiteño Juan-pablo,
Very easy, indeed !
The part of your list, below, is well-delimited, by commas, in 13 rows of 16 columns each !
plage, plage, 2000, 12582912, 0, 275.112, 43.6829, 0.57576, 1568.3, 1491.7, 29.7886, 921.708, 767.69, 15.1822, 970.818, null plage0, plage, 2000, 12582912, 0, -470.48, -690.498, -16.542, 470.48, 690.498, 16.542, 0.0, 0.00012207, 4.76837e-007, 835.711, null plage1, plage, 2000, 12582912, 0, -456.201, -769.794, -15.5455, 456.201, 769.794, 15.5455, 0.0, 0.0, -4.76837e-007, 894.955, null plage2, plage, 2000, 12582912, 0, -788.48, -1012.48, -16.8566, 788.48, 1012.48, 16.8566, 0.0, 0.0, -4.76837e-007, 1283.39, null plage3, plage, 2000, 12582912, 0, -716.8, -680.96, -16.7993, 716.8, 680.96, 16.7993, 0.0, 0.0, 0.0, 988.833, null plage4, plage, 2000, 12582912, 0, -788.48, -430.08, -17.4505, 788.48, 430.08, 17.4505, 0.0, -0.000244141, 4.76837e-007, 898.317, null plage5, plage, 2000, 12582912, 0, -788.48, -286.72, -16.8566, 788.48, 286.72, 16.8566, 0.0, 0.0, -4.76837e-007, 839.162, null plage6, plage, 2000, 12582912, 0, -788.48, -756.566, -16.8566, 788.48, 756.565, 16.8566, 0.0, 0.0, -4.76837e-007, 1092.88, null plage7, plage, 2000, 12582912, 0, -415.092, -669.848, -2.35125, 415.092, 669.848, 2.35125, 0.0, 0.0, 0.0, 788.038, null plage8, plage, 2000, 12582912, 0, -323.538, -698.055, -1.83764, 323.538, 698.055, 1.83764, 0.0, 0.0, 0.0, 769.39, null plage9, plage, 2000, 12582912, 0, -344.821, -653.995, -2.31168, 344.821, 653.995, 2.31168, 0.0, 0.0, 0.0, 739.335, null plage10, plage, 2000, 12582912, 0, -414.529, -697.8, -3.58363, 414.53, 697.8, 3.58363, 0.0, 0.00012207, 0.0, 811.648, null plage11, plage, 2000, 12582912, 0, -429.283, -679.338, -4.19869, 429.282, 679.338, 4.1987, 0.0, 0.0, 0.0, 803.618, null plage12, plage, 2000, 12582912, 0, -650.986, -725.165, -29.6797, 650.987, 725.165, 29.6797, 0.0, 0.0, -9.53674e-007, 974.951, null
So, the general form to catch any text, without leading blank characters, located in the column N, is, simply :
SEARCH :
(?-s)^(.*?,){N-1}\h*\K[^,\r\n]+
IMPORTANT :
-
Of course, you need to select the Regular expression search mode
-
In the regex, replace the generic form N-1 by a REAL number. For instance, if you would like to reach the 13th column, you’ll replace the form N- 1 with the number 12 ! So, in your case, you need to type the regex
(?-s)^(.*?,){2}\h*\K[^,\r\n]+
, in order to catch the number 2000 of the third column !
Notes :
-
To begin, the
(?-s)
modifier, ensure that the dot symbol matches standard characters, only, even if you previously checked the . matches newline option ! -
Then, the zero-length assertion
^
represents the very beginning of any line -
The syntax
(.*?,){N-1}
represents any text, after the beginning of a line, without commas, till an ending comma, repeatedN-1
times -
The
\h*
stands for possible horizontal blank characters : Space (\x20
), Tabulation (\t
) or No-Break space (\xa0
), leading the column N -
The
\K
form reset the regex engine, so that everything previously matched is forgotten. So the regex engine position is, now, located just before the first non-blank character of columnN
-
Finally, the
[^,\r\n]+
is a negative class of characters which stands for any non null range of characters, different from a comma and from the EOL characters\r
or\n
=> Therefore the final match, on each line, is, only the whole text of column N, without possible leading blank characters and without the ending comma or without the EOL characters, if column 16 is chosen !
Et voilà !
Best regards,
guy038
-
-
ok, merci/thanks