Sort messages by line number