I need to add aditional Numeral

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
G Herbert
Posts: 1
Joined: Wed Mar 19, 2008 4:09 am

I need to add aditional Numeral

Post 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.
nvj1662
Posts: 53
Joined: Thu May 17, 2007 10:02 am

Post by nvj1662 »

If you post this in the "Regular Expressions" forum I'm sure somebody there will be able to help.
ACRobin
Posts: 134
Joined: Fri Nov 04, 2005 9:51 pm
Location: Northumberland,UK
Contact:

Post 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.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
Post Reply