On Wed, Nov 11, 2015 at 13:54:50 -0700,
 jd1008 <jd1...@gmail.com> wrote:
The sort command does not provide for a way to say that the key is the last word in a line,
where the file contains lines of varying number of words,
and where words are groups of characters without spaces or tabs.

Thus

sort -k <what should this position be> <filename> ....

How can one tell sort to chose the last word in the line as the sort key?

You can't. Field specifiers are relative to the start of the line. There isn't a way to specify them relative to the end of the line.


The key is always the entirety of the last word.

If you just need grouping and not a particular order you might try something like:
rev <filename> | sort | rev

If you need something specific, you'll probably need to write your own program. It should be reasonably short in perl.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to