Re: Replace in specified column only

Find, replace, find in files, replace in files, regular expressions

Re: Replace in specified column only

Postby chase » Sun Sep 19, 2004 9:50 pm

:o

I'd like to do something quite simple... yet it seems complex ?

I have a large file... each row is delimited by a crlf...

I'd like to replace each occurence in Col 9 of each row.. so that if col 9 has a "A" in that col... I'd like to replace it with a "B".

Can this be done ?
User avatar
chase
Newbie
 
Posts: 2
Joined: Sat Sep 18, 2004 11:00 pm

Re: Replace in specified column only

Postby Mofi » Mon Sep 20, 2004 1:30 am

Activate Column Mode.

Set cursor to column 9 (with mouse or cursor keys).

Press Ctrl+Shift+End to select everything to the end of file.

If last line is an empty line, while still holding Shift press Up.

While still holding Shift move cursor Right till whole column 9 is selected.

Open Replace dialog.

Enter the Find and Replace characters.

Activate Match Case, if necessary.

Important: activate Selected Text.

Press button Replace All.

Finished!
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Replace in specified column only

Postby chase » Mon Sep 20, 2004 8:06 am

Hmmm it would have to be that easy... wouldn't it ?

Thanks again...
User avatar
chase
Newbie
 
Posts: 2
Joined: Sat Sep 18, 2004 11:00 pm

Re: Replace in specified column only

Postby grey14me » Mon Jan 03, 2005 1:43 pm

could someone please tell me how you would do the above, in only a few lines...say lines 12 through 23? thanks in advance!
User avatar
grey14me
Newbie
 
Posts: 1
Joined: Mon Jan 03, 2005 12:00 am

Re: Replace in specified column only

Postby Mofi » Thu Jan 06, 2005 9:41 am

There is no real difference between whole file or only a certain range. Simply select with mouse OR with cursor keys while SHIFT is pressed the lines/columns where you want to replace something. You can also use Edit - Select Range to do the selection, if you need a third method.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions