sed remove space

C++
sed 's/ //g' filename
Source

Also in C++: