sort as the sort command does