2 Replies Latest reply on Jul 19, 2013 3:57 AM by camilo umana

# How to grep decimal and periods in very sorted situations?

I have tables where the proofreading was not made and many numbers mix periods and commas and only the two last decimal numbers should have a preceding comma.

4.865,226.06  /  must be= 4.865.226,06

5,444.01                              5.444,01

21,005.345,29                    21.005.345,29

It seems easy to grep the last two characters (as the decimal are always finishing the line)

\.\d{2}+\$

and later work the rest. But involves many steps... Poor Grepping.

How to improve this?

• ###### 1. Re: How to grep decimal and periods in very sorted situations?

You can't do it all at once you need two steps.

For the decimal separator you could use \.(?=\d{2}\$) if there are are always exactly two decimal places, otherwise I'd try \.(?=\d+\$)

This is only good for the end of the paragraph, however, and if there are three decimal places it would interfere with the next query if there is anything following the decimal portion.

For the thosands separator I would use (?<=\d),(?=\d{3}[^\d])

• ###### 2. Re: How to grep decimal and periods in very sorted situations?

Yes, Peter. Used colours to check and modify the changes. Perfect. Thank for your time (again!).

 702.442,47 274.451,93 240.626,34 220.528,03 341.926,81 246.642,41 355.327,01 223.284,33 240.325,89 300.113,05 865.432,35 822.608,04 785.636,79 913.019,44 731.967,75 48.216,15 41.594,34 26.553,15 55.202,76 69.209,22 3.249.240,12 2.008.367,98 1.668.416,21 1.610.600,79 1.604.824,03 651.598,13 172.007,59 936.731,85 704.891,75 633.723,61 35.976,31 51.573,36 58.941,36 57.511,41 59.149,59 2.052.883,10 2.050.849,59 1.793.714,19 1.872.404,39 1.597.026,26 2.006.528,58 1.004.932,92 976.805,89 745.839,20 758.518,14 249.147,58 231.233,79 191.983,54 184.971,22 132.852,97 285,33 285,33 285,33 285,33 285,33 1.255.248,30 1.121.087,79 764.604,58 761.107,28 830.278,52 6.251.667,33 4.631.970,37 4.723.066,75 4.327.010,57 4.011.834,42 9.500.907,45 6.640.338,35 6.391.482,96 5.937.611,36 5.616.658,45 69.953,20 357.294,29 231.718,37 476.457,56 35.878,53 1.254.767,91 1.098.496,17 1.040.292,17 966.139,77 677.576,33 286.888,67 272.441,32 369.030,17 339.061,36 251.632,33 113.800,72 59.837,86 60.441,54 44.429,82 46.669,31 57.291,24 46.814,98 31.682,14 28.263,54 26.643,57 40.705,08 45.770,09 33.301,25 49.189,03 63.669,45 311,25 - - - - 15.207,05 12.080,41 12.889,36 13.800,40 13.385,76 - 30.350,00 - - - 1.838.925,12 1.923.085,12 1.779.355,00 1.917.341,48 1.115.455,28 - - 283.663,94 477.506,98 955.290,25 557,84 574,62 732,23 510,08 365,46 17.719,51 16.843,96 9.523,02 9.466,41 9.871,00 21.980,27 15.167,69 8.355,11 15.130,47 45.635,13 62.118,50 42.795,31 41.730,73 18.688,68 - 224.650,00 224.650,00 105.000,00 105.000,00 105.000,00 93.730,30 ,00 ,00 ,00 ,00 420.756,42 300.031,58 449.005,03 626.302,62 1.116.161,84 2.259.681,54 2.223.116,71 2.228.360,04 2.543.644,10 2.231.617,13 4.482,40 3.339,69 3.338,10 2.842,63 2.842,63 4.865.226,06 2.278.518,98 2.328.500,32 1.621.197,43 1.606.980,31 584.734,90 429.901,01 362.560,36 277.308,39 214.386,84 134.267,02 321.727,62 549.004,58 570.376,48 591.748,38 389.454,65 254.833,98 147.302,41 153.322,49 130.992,07 7.812,58 7.812,58 7.812,58 7.812,58 7.812,58 1.255.248,30 1.121.087,79 764.604,58 761.107,28 830.278,52 7.241.225,91 4.417.221,65 4.163.122,92 3.393.967,27 3.385.041,33 9.500.907,45 6.640.338,35 6.391.482,96 5.937.611,36 5.616.658,45