I am trying to remove any black spaces from the end of lines. I am doing this and I am wondering why it is not working.
sed -i '' 's/\s*$/ endOfLine/g' myFile
I get this
MyLine
endOfLine
MyLine
endOfLine
I expect this
MyLine endOfLine
MyLine endOfLine