fixing the sed inline edit command to delete last line