I have a file full of data in columns
sarah mark john 10 20 5 x y z
I want to sort the data so the columns stay intact but the
Good one-liner gets the job done:
perl -ane '$,=" "; print sort @F; print "\n";' file
I found it here: http://www.unix.com/unix-for-advanced-and-expert-users/36039-horizontal-sorting-lines-file-sed-implementation.html