Q:

How to sort random strings in a file via shell script

I have a file with these strings at random.  How can i sort them horizontally and also eliminate any duplicates. 
cat file
ticket-125788   ticket-126824    ticket-126957   ticket-126914
ticket-127220
ticket-125948                       ticket-126914

ticket-127030
ticket-127262
 ticket-127012  ticket-127022
ticket-127035

     ticket-126961
ticket-127024

Desired output:
ticket-125788 ticket-126824 ticket-126957 ticket-127220 ticket-125948 ticket-126914 ticket-127030 ticket-127262 ticket-127012 ticket-127022 ticket-127035 ticket-126961 ticket-127024

A:

This will do the trick:
$ grep -o '\S*' file | sort -u | tr '\n' ' '
ticket-125788 ticket-125948 ticket-126824 ticket-126914 ticket-126957 ...

grep -o puts each ticket on a separate line. 
sort -u sorts and removes duplicates. 
tr '\n' ' ' flatten the output to single line. 

Alternatively using xargs:
$ xargs -n1 < file | sort -u | xargs
ticket-125788 ticket-125948 ticket-126824 ticket-126914 ticket-126957 ...

