in reply to Key Word In Context system (golf, anyone)?

This is a bit shorter:
% perl -n -e 'sub f{map{push@_,shift;"@_"}@_}push@b,f split;END{$, +="\n";print sort@b}' filename
The actual code here (between the single quotes) is 72 chars. Though that's cheating slightly since you need the -n to make it work.

Should have the same output. I'm sure there's a faster/shorter way to do that f sub. Someone'll come up with it.