As a *nix user I’ve used the command line sort tool often. One of its most useful options is -k, key, using which one can specify a position within the row as the key on which the sort is based, e.g., cat | sort -k 5 will output the contents of with its lines sorted by whatever is in the fifth position of every line. For columnar, csv, tab-delimited files this is brilliant, especially as it is not length or delimiter dependent. The sort options of SublimeText and all plugins I can find do not replicate this function.
Two alternatives come to mind:
- A new plugin that does this.
- A way to run that sort command on an open file (or selected text) within SublimeText.
I can perhaps create a plugin but such is many days (weeks?) away.
My query here is if there is a way of doing 2? At least one editor (e.g., medit) does provide the ability to create a command (macro?) that takes as its input the current file (or buffer), pass it to a command line tool, and then capture the tool’s output to a new (or the current) buffer. Can SublimeText do this? If so, please point me to the documentation that explains how.
Much thanks and regards.