The command below works for deleting the first 3 lines:sed -i -e 1,3d t.txtSo I tried substituting the 3 with a variable in a script as belowNrLines=$(wc -l t.txt)sed -i -e 1,$NrLines{d} t.txtand get following error:sed: -e expression #1, char 13: unexpected `}'What am I doing wrong?
Remove first n lines from file with variable
shell script;sed
It seems command substitution and braces are misused.NrLines=$(wc -l < t.txt)sed -i -e 1,${NrLines}d t.txt