I want to sort a file that has 3 columns of uneven length and delimitted by tabs. How can I sort on the second "column".
I've gone back and forth between Textpad and Excel, using Excel to sort, but Excel adds double quotes when I open the file again in Textpad, which just makes more work.
thanks
Elaine
sorting a tab delimitted file
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Mark Schnitzius
Re: sorting a tab delimitted file
There's no explicit way to do a sort on the second tab-delimited column in Textpad. But you can set up a macro to do what you want, I think:
1. Start your macro recording.
2. Swap the second column with the first by doing a Replace (with Regular Expression checked) of
^\([^\t]*\)\t\([^\t]*\)
with
\2\t\1
Do a Replace All.
3. Do a normal Sort.
4. Repeat step 2 to swap the columns back
5. Stop your Macro recording.
You should then have a macro that does what you want. Hope this helps.
1. Start your macro recording.
2. Swap the second column with the first by doing a Replace (with Regular Expression checked) of
^\([^\t]*\)\t\([^\t]*\)
with
\2\t\1
Do a Replace All.
3. Do a normal Sort.
4. Repeat step 2 to swap the columns back
5. Stop your Macro recording.
You should then have a macro that does what you want. Hope this helps.