4 ms·
On X-based systems, xsel -ob | sort | xsel -ib But if you're in a high-octane development environment like vi, there's no need to resort to a separate terminal
by jepler 10y ago
On X-based systems, xsel -ob | sort | xsel -ib
But if you're in a high-octane development environment like vi, there's no need to resort to a separate terminal window to invoke 'sort clipboard'. just mark a range of lines (v) then :!sort to filter through good old unix sort.
- jepler 10y agoIterating on this idea just a little bit, you realize you want to apply any shell filter to your clipboard ... #!/bin/sh # save as xfilt xsel -ob | "$@" | xsel -ib so, for instance, get a bit of json in your clipboard http://json.org/example.html http://json.org/example.html and run xfilt jq .glossary.title. Now your clipboard contains "example glossary" instead of the whole json file. One wrinkle is, if you get your filter wrong, you have to return to the original source to copy again, because the operation is destructive each time...