I have the given text:
# Blub
Hello this is a blub text.
# Bla
This is the bla text.
# Abba
Another text.
Is it possible to sort for the lines with the #? So that the resulting text is:
# Abba
Another text.
# Bla
This the bla text.
# Blub
Hello this is a blub text.
Preferably using vim or emacs.
In Emacs,
sort-regexp-fields#[^#]*\&The first regexp delimits the record, and the second specifies the key for sorting.
If you’re at liberty to choose the marker character and use
*instead of#, you may use org-mode’s commandorg-sort-entriesinstead, which saves you from entering the regexps.