I wish to delete the last three lines of a file iteratively. I tried this in unix shell scripting but it is not working..
lines=$(wc -l < s27.cnf)
sed '$target,$lines d' s27.cnf > f2.cnf
mv f2.cnf s27.cnf
I am getting an error "sed: 1: "$target,$lines d": undefined label 'arget,$lines d'
So was not sure what to use.
I would appreciate help on this.