I am trying to understand a shell script which uses the command below:
sed '$d;1,2 d;s/^ //' $file1 > $file2
This is deleting the last line of the file and the first two lines.
sed 'd'elete command is expecting one or two arguments. If one, then the delete will happen for that line; if two, then the delete will happen from the line matching the first argument through the line matching the second. The arguments can be regular expressions, or line numbers.
sed also recognizes
$ for the last line.
$d is deleting the last line. and
1,2d is deleting the 1st through 2nd lines.
man sed for all the gory details.