Sort based on length of line and alphabetical each length

General questions about using TextPad

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

Post Reply
agent86
Posts: 18
Joined: Wed Apr 26, 2006 2:59 am
Location: SF Bay Area

Sort based on length of line and alphabetical each length

Post by agent86 »

I need to sort a text file, longest line length to shortest, and alphabetical with the list for each length that is the same length. Any ideas?

Thanks
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

There's no way in TextPad of sorting lines by length that I know of. You can use regular expressions to find lines of a given length (or shorter than or greater than a given length) but it would be very tedious to use them for sorting.

^.{42}$ matches lines exactly 42 characters long.
^.{42,}$ matches lines at least 42 characters long.
^.{0,41}$ matches lines at most 42 characters long.

These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
You can use Tools | Sort... to sort the lines in each group of lines of the same length. This, again, could be very tedious.
Post Reply