Page 1 of 1

How do I replace any single character in postion 79

Posted: Wed Mar 17, 2004 4:05 pm
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

Posted: Wed Mar 17, 2004 4:50 pm
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.

Posted: Wed Mar 17, 2004 5:15 pm
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