in reply to first elements in array, split join and sort problem
This might help (will ignore empty lines if they exist):