Replace text in certain columns

General questions about using TextPad

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

Post Reply
ps1290
Posts: 1
Joined: Fri Apr 30, 2004 1:44 pm
Location: New York

Replace text in certain columns

Post by ps1290 »

I have a text file that is 750 characters long. I need to replace text
starting in column 364 for 4 characters. I have to do this on several
occurance of the data. How do I do this?
Thanks
Paul
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Re: Replace text in certain columns

Post by ben_josephs »

The following assumes you are using POSIX regular expression syntax:
Configuration | Preferences | Editor
[x] Use POSIX regular expression syntax
Using Search | Replace:
Find what: (^.{363}).{4}
Replace with: \1****

[x] Regular expression
where **** is the replacement for the 4 characters.
ps1290 wrote:I have a text file that is 750 characters long. I need to replace text
starting in column 364 for 4 characters. I have to do this on several
occurance of the data. How do I do this?
Jonathan_Taylor
Posts: 5
Joined: Wed Apr 30, 2003 3:02 pm
Location: Halifax, West Yorkshire, England

Post by Jonathan_Taylor »

Alternatively, block select the area of the file in question.

(This can be done using by selecting text while block select mode is on (Configure->Block Select mode) or pressing the Alt key when selecting).

If you want to change the four characters in EVERY line, then right-click->Fill Block will do the trick.....ensure "Fill Mode: replace" is selected.

Alternatively use Search->Replace, and ensure "Scope: selected text" is selected.
Post Reply