To delete all the trailing spaces of each line of file test1
sed 's/[ ][^ ]*$//' test2
sed 's/[ ][ ]*$//' test2
sed 's/[ ][ ]*$/' test2
sed 's/[ ][ $]*$//' test2