I want to append some string after each line of the file except the header and footer of the files . So I have used below command to change the range of the lines except header and footer but its deleting header and footer and I do not want to delete the header and footer lines .
sed -n '2,5p; '"$str_var"'' abc.dat > abc.dat.temp
even I have tried to skip the header and modified other lines by using below command but no options for footer/ trailer line to keep it as unchange .
sed '1! s/$/'"$str_var"'/g' abc.dat > abc.dat.temp
any suggestions how to change all the lines of the file except the header and footer line and the command should not be deleting the header/footer line .