replaced head and tail with sed equivalent
Minor fix