The sort command lets me put lines in alphabetical order and remove duplicate lines. I need something similar that can sort the words on a single line, put them
sort
This works for me:
$ echo "zebra ant spider spider ant zebra ant" | xargs -n1 | sort -u | xargs ant spider zebra
You can transform a list of words in a single row to a single column with xargs -n1 , use sort -u and transform back to a single row with xargs.
xargs -n1
sort -u
xargs