How do I replace any single character in postion 79

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Webbhe
Posts: 6
Joined: Tue Oct 21, 2003 6:01 pm

How do I replace any single character in postion 79

Post by Webbhe »

with 2 characters from postions 25 & 26 of the same line...i.e.

DEC 15-00 005946 15Dec00 PJ1484 2,115.39 Pd:Dec29c

I want to replace the 'c' in position 79 with the '00' in positions 25 & 26 to give me the correct century...this is a report file...i.e. not a flat file.

TIA...Webbhe
User avatar
ramonsky
Posts: 88
Joined: Fri Nov 14, 2003 10:54 am

Post by ramonsky »

1. Place cursor at start of line
2. Start recording a macro
3. Move cursor right until it is just before the 00.
4. Press and hold shift. Move cursor right two more places. Release shift.
5. Do Ctrl-X.
6. Move cursor right until it is just before the c.
7. Press Ctrl-V.
8. Similarly, use the Ctrl-X, Ctrl-V technique to move the c into the right position.
9. Move the cursor back to the start of the line.
10. Move cursor down one line.
11. Stop recording the macro.

Then you can hit Ctrl+R to get each line done automatically.
ben_josephs
Posts: 2457
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Or, using regular expressions:

Replace (F8)
Find what: ^(.{24})(..)(.{52}).
Replace with: \1\2\3\2
[x] Regular expression

with Posix syntax:

Configure | Preferences | Editor
[x] Use POSIX regular expression syntax
Post Reply