Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

2010-08-06

Sort with uniq comma separated items with POSIX utils.

Suppose you have string:
str="item4, item2, item3, item2, ..."
and want alphabetically sort items in shell script.

2009-10-11

Sort and uniquify lines in Emacs.

For only sort lines exist built-in func: C-x sort-lines.

Sort and uniquify lines:

  • select region
  • C-u M-| sort -u RET

With transient-mark-mode and delete-selection-mode enabled:

  • select region
  • M-| sort -u RET
to replace selection with sorted and uniquified lines.