Colum Mode alternative?

General questions about using TextPad

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

Post Reply
xus
Posts: 4
Joined: Thu Feb 17, 2005 3:35 am

Colum Mode alternative?

Post by xus »

I used to use a competing text editor and have found textpad a lot quicker and generally better to use.

The one feature I really NEED to have though doesn't seem to be apparent..

I work a lot with huge csv files and price lists and often I need to add in a few digits to a column. In my old text editor there was a feature called Column Mode. Is there something similar? I cannot do a search/replace because each line is different.

Simple example would be there's a huge price list, but with no $ sign. I need to add in a $ about 10 columns in..

Any feedback appreciated!
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Configure, Word Wrap Off, Block Select Mode on.
Select area to insert.
Edit, Fill Block......
Hope this was helpful.............good luck,
Bob
xus
Posts: 4
Joined: Thu Feb 17, 2005 3:35 am

Post by xus »

Great! Much appreciated.
Lostgallifreyan
Posts: 25
Joined: Mon Feb 14, 2005 10:51 am

Post by Lostgallifreyan »

TextPad's block mode rocks! :)

Remember the shortcut: Hold the Alt key then click and drag. (If you are already in block mode, same move momentarily enters line mode).

I think I can guess what that 'competing text editor' might be... Well, if it's UltraEdit, it wasn't as easy and fast as it is in TextPad. Another thing: After search/replace moves, the selection in TextPad remains as you put it, in case you want to use it for another edit. UltraEdit left me fiddling about and reselecting after every attempt to do anything. Awful..
User avatar
boldan
Posts: 31
Joined: Tue Jul 22, 2003 2:47 pm
Location: Toronto
Contact:

Post by boldan »

Bob Hansen wrote:Configure, Word Wrap Off, Block Select Mode on.
Select area to insert.
Edit, Fill Block......
I don't get it. A CSV file is not column aligned. How can you use the columnar block? Here is an example:

-1282,M,06, ,20050218,/
====,====,====,====,====,/
-288,M,01, ,20050218,/
707,M,01, ,20050218,/
====,====,====,====,====,/
-1694,M,23,1,20050218,/
1604,M,23, ,20050218,/
====,====,====,====,====,/
-952,M,02,1,20050218,/
====,====,====,====,====,/
-49,B,01,1,20050218,/
-608,M,01, ,20050218,/
====,====,====,====,====,/
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

@boldan, but it must have been the case for xus as block mode is the pretty much the same in all editors. In your example this would not work. (Btw, the Code tags are good to post this kind of data) Chances are you must therefore use a find/replace with or without a regex.
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
boldan
Posts: 31
Joined: Tue Jul 22, 2003 2:47 pm
Location: Toronto
Contact:

Post by boldan »

s_reynisson wrote:@boldan, but it must have been the case for xus as block mode is the pretty much the same in all editors. In your example this would not work. (Btw, the Code tags are good to post this kind of data) Chances are you must therefore use a find/replace with or without a regex.
I wonder how it worked for xus, because in his first message he wrote:
I cannot do a search/replace because each line is different.
Lostgallifreyan
Posts: 25
Joined: Mon Feb 14, 2005 10:51 am

Post by Lostgallifreyan »

There are several fast tricks that can help with making columns, using TextPad's block select.

One is setting tabs to a large value, then replacing the seperator (comma) with a tab, using RexExp replace \t to do it. Then block select any surplus space after converting tabs to space (most easily done by setting it to do on saving, so one click does this), and delete the block of spaces to get the column spacing you want.

If you want a right-justified column, like for numbers, select the whole column and copy the selection to a new file for the next move. Adjust the alignment for right side justification. Trailing spaces will be ignored. Block select and copy it back.

Sounds awkward, but it's much easier to do than it is to say. Stuff like this is as easy to do as to think, in TextPad, saving loads of awkward processing, as then you can use column keys for sorting, or RegExp interval operators instead of more complex expressions for many tasks.

Collimating data is easier than working out RegExp's and often makes making macros and RexExp's easier as well, once there is more regularity to each line.

Which is why I like this tool so much.
xus
Posts: 4
Joined: Thu Feb 17, 2005 3:35 am

Post by xus »

boldan wrote:
s_reynisson wrote:@boldan, but it must have been the case for xus as block mode is the pretty much the same in all editors. In your example this would not work. (Btw, the Code tags are good to post this kind of data) Chances are you must therefore use a find/replace with or without a regex.
I wonder how it worked for xus, because in his first message he wrote:
I cannot do a search/replace because each line is different.
By this I meant that all the data is different, not the columns (and their size). I should have left out about csv's, they're not really relavent to my problem.

My files often contain strings of data, like this

12345,6495226686,My Company
54321,44885599677,Your Company
22334,587555995,His Company
11223,445566556,Her Company
44556,445566556,The Company

In a file like the above, I may need to insert a +64 or something like that after the first comma. In my old text editor (yes it was Ultraedit) it was a 1 click process to go into column mode, highlight the 'column' area after the first comma and enter in +64.. it would autofill all of the selected columns with +64

Using block mode is a bit more fiddly, I have to actually select the comma's in my above example and search/replace them with ,+64

What about if i wanted to insert a $ into the first column of the first line? I have nothing for block mode to select and search/replace.

Sorry I haven't used regex in the past much..
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

xus wrote:What about if i wanted to insert a $ into the first column of the first line? I have nothing for block mode to select and search/replace.
Tick "Regular expression" in the Replace dialog and enter:
Find: ^
Replace: $
Hit "Replace" or "Replace All" if you want it for all lines and you're done.
In plain language it means: Find the start of line and select nothing (^ is an anchor, it just places the regex engine at the start of each line) and replace that nothing with a $.
xus wrote:Sorry I haven't used regex in the past much..
Don't worry, hang around in this forum for an hour or two and you will get addicted - muhwahahaha!
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
boldan
Posts: 31
Joined: Tue Jul 22, 2003 2:47 pm
Location: Toronto
Contact:

Post by boldan »

xus wrote:What about if i wanted to insert a $ into the first column of the first line? I have nothing for block mode to select and search/replace.

Sorry I haven't used regex in the past much..
In this case, you can "Increase indent". This will insert a group of spaces before each marked line, then you can mark a vertical bloc and replace space with what you need:

1. Mark all lines
2. Edit - Increase indent
Lostgallifreyan
Posts: 25
Joined: Mon Feb 14, 2005 10:51 am

Post by Lostgallifreyan »

Or drag select, then Tab. :)

xus, I take your point about UltraEdit, and the column fill, but the thing with TextPad is that although things like this are usually a couple more clicks away, the power is great. It's the difference between having lots of dedicated functions, and having a simple syntax you can construct a lot more with once you get used to it. It's easier for the body and brain to remember a few short key sequences than it is to remember a larger number of single click tools, so this way it makes work easier and much faster, at least it does for me.
It also keeps me more able to think of solutions to things where no instant tool exists.
xus
Posts: 4
Joined: Thu Feb 17, 2005 3:35 am

Post by xus »

Great, thanks so much for all of your input!

I understand Lostgallifreyan, I will not be going back to Ultraedit.. I have taken a liking to Textpad and the support forums.

Now about this regex.. ;)
Post Reply