This definitely sounds like a job for
regular expressions. You should be able to grab the word to the left of
searching Using character classes, specifically
\S, which "represents any non-whitespace character". You can then use that to write your own sorting routine, as described in
sort. Don't forget that
cmp is case sensitive, so you may want to use
lc in your comparison.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.