extra characters at the end of n command

When you use sed to insert a template file into another file with the command

# $1 String to insert
# $2 File to insert to
# $3 String to insert after
sed  "/$3/a\\
$1\\
" $2 > tmp && mv tmp $2	

and get the error message

extra characters at the end of n command

Make sure the template file supplied in $1 does not have an empty line at the top.

Leave a comment

Your email address will not be published. Required fields are marked *