Remova o espaço no final da linha do arquivo

Use either one of both next commands with sed 's/to_replace/replace/':
sed 's/ *$//' file
sed 's/[[:blank:]]*$//' file
Armandres