On 12/12/2017, at 22:46, Vlad Ghitulescu <[email protected] <mailto:[email protected]>> wrote: > I’ll correct this right now: I would like to sort alphabetically this list of > songs in regard to column 3 (where the title of the song begins) (Thanks > again, Chris! ;-) > - Blackbird - The Beatles > - For No One - The Beatles > * Hound Dog - Elvis > - I Don't Eat Animals - Melanie > - Is There Anybody Out There - Pink Floyd >
Hey Vlad, By column 3 I'm assuming you mean the 3rd single character from the left. When looking at this text as a table you'd generally consider that to be column 2. This pattern works in the Sort Lines command: ^(.) +(\w.+(?= - )) - (\w.+)$ I've encapulated the leader-character, the song name, and the group name as field 1, 2, and 3. So you can sort on any of those columns. If you want to do this with a text-filter then it's quite straightforward: #!/usr/bin/env bash sort -k2,2 * Babe I'm Gonna Live You - Led Zeppelin - Blackbird - The Beatles - Blackbird - The Beatles * End Of The Line - The Traveling Willburys ... Personally I'm going to prefer a table to be nicely formatted by column, so I'll do something like this: #!/usr/bin/env bash sed -E $'s! - !\t-\t!' | sort -k2,2 | column -t -s $'\t' * Babe I'm Gonna Live You - Led Zeppelin - Blackbird - The Beatles - Blackbird - The Beatles * End Of The Line - The Traveling Willburys ... -- Take Care, Chris -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
