Hi, Chris!

See below please:


On 13 Dec 2017, at 7:42, Christopher Stone wrote:

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.

Yes, the 3rd single character from the left, sorry for the confusion (I think I learned naming them as column long ago as a Vim-user :-)


This pattern works in the Sort Lines command:

^(.) +(\w.+(?= - )) - (\w.+)$



That worked!
Thanks!


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.

Cool!
Thanks again!


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
...

Hmmm… I'm ashamed to ask, but I forgot: How/Where do I define a new text-filter?


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
...

That looks nice too, yes - but I like the older style more for this very list. But: Could you please explain me the command? It could be useful for other list I have.


--
Take Care,
Chris

Thanks again!
Vlad

--
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.

Reply via email to