Page 1 of 1

I need to add aditional Numeral

Posted: Tue Dec 09, 2008 4:28 am
by G Herbert
Hi all,

I have a text file with coordinate values as well as a height value.
Easting, Northing, Height
eg,
319773.76,6242000.07,18.74
319379.98,6242000.02,7.33
319422.22,6242000.00,4.43

After each of the decimal points I need to add an additional zero to make 3 decimal places. I can do it easy enough for the Easting and the Northing values, but can not find an answer to include the zero into the variable length "Height" value.

I have two thousand text files with about 200,000 lines in each of the text files

Can anyone see a scripting route I can take to fix my dilema.

Many thanks in advance.

Posted: Tue Dec 09, 2008 8:44 am
by nvj1662
If you post this in the "Regular Expressions" forum I'm sure somebody there will be able to help.

Posted: Tue Dec 09, 2008 8:46 am
by ACRobin
A regular expression I am sure would solve your problem easily, But a long hand method would be:

Record a macro.
Move the cursor to the start o the file (shft+ctrl+home).
Start recording the macro.
key sequence is "End", "0", "down arrow"
Save Macro.
Run macro to end of file.

Job done.

Lucky the first two coordinates are fixed length, but a regular expression would have been a more accurate method to do this and I am sure someone will provide the details for that.

Posted: Tue Dec 09, 2008 9:18 am
by ben_josephs
You said you wanted the zero after the decimal point, thereby changing the values. This will do that:
Find what: .
Replace with: .0

[ ] Regular expression [i.e., not selected]

Replace All
Did you mean you wanted the zero after all the digits? This will do that:
Find what: ([0-9]+\.[0-9]+)
Replace with: \10

[X] Regular expression

Replace All
So will this:
Find what: ([0-9])(,|$)
Replace with: \10\2

[X] Regular expression

Replace All
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax