Created
September 2, 2017 17:20
-
-
Save dnlcorrea/9fef2b29e983930e48b1c539e4220116 to your computer and use it in GitHub Desktop.
Sort region by character length using awk in an Emacs buffer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun awk-sort (&optional b e) | |
"Sort region by character length using awk." | |
(interactive "r") | |
(shell-command-on-region b e "awk '{ print length(), $0 | \"sort -n | cut -d\\\\ -f2-\" }'" (current-buffer) t) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment