truncate -s -"$(tail -n1 file | wc -c)" file