I am trying to sort a list of names followed by another string such as:
John Doe AVAIL Sara Doe CALL Jim Doe AVAIL
I am trying to sort th
Probably far from optimal, but
sed -r ':r;/(^|\n)$/!{$!{N;br}};s/\n/\v/g' names | sort | sed 's/\v/\n/g'
seems to do the job (names is the file with records). This allows records of arbitrary length, not just 2 lines.
names