Page 1 of 1
Find and replace
Posted: Fri Dec 05, 2003 4:15 pm
by gajay
Hello,
I have a text file which has a column containing data like 0.0000, 3.7800, 67.0900, etc. I want to remove the trailing two zeros. How can I do this?
Thanks.
Posted: Fri Dec 05, 2003 4:27 pm
by s_reynisson
Using POSIX regular expression:
find ([0-9]+.[0-9]{2})[0-9]{2}
replace \1
HTH
edit: it would be safer to limit the search to the right of the decimal
comma, ie. if there is a space (_) there in your file you would use it like:
find ([0-9]+.[0-9]{2})[0-9]{2}_ and replace \1_
Posted: Fri Dec 05, 2003 4:49 pm
by gajay
s_reynisson wrote:Using POSIX regular expression:
find ([0-9]+.[0-9]{2})[0-9]{2}
replace \1
HTH
edit: it would be safer to limit the search to the right of the decimal
comma, ie. if there is a space (_) there in your file you would use it like:
find ([0-9]+.[0-9]{2})[0-9]{2}_ and replace \1_
Thanks for your help but it did not work. I am able to find the text with \.[0-9][0-9]00 but don't know how to remove the last two zeros.
Posted: Fri Dec 05, 2003 4:55 pm
by s_reynisson
Sorry for not being clear on this, goto Configure->Preferences->Editor
and tick the "Use POSIX regular expression syntax" box.
In the replace dialog tick the "Regular expression" box.
s_reynisson wrote:Using POSIX regular expression
Posted: Fri Dec 05, 2003 4:59 pm
by gajay
Worked like a breeze. Thanks a bunch.