On X-based systems, xsel -ob | sort | xsel -ib<p>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.