How to remove all blank spaces in a file

I have a file which contains data such as that shown below. How do i remove all the blcnak spaces, before, during and at the end of each line in one command?

300015,   58.0823212,   230.424728 
       300016,   58.2276459,   229.141602        
300017,   58.7590027,   226.960846       
   300018,   59.7599487,    225.608902         
 300019,   61.1152496,   224.612473

I want the below:

300015,58.0823212,230.424728
300016,58.2276459,229.141602
300017,58.7590027,226.960846
300018,59.7599487,225.608902
300019,61.1152496,224.612473

Try:

sed 's/ //g' input-file >output-file
 
awk 'gsub(" ","")' input.txt > output.txt

If some line has no spaces, the awk command will prevent that line from going to the output file.

Third approach, third tool:

tr -d ' ' <inputfile >outputfile

why not to attack on ,?

with sed..

sed 's/, /,/g' file

and with awk..

awk 'gsub(", ",",")' file
awk -F ", " '{$1=$1}1' OFS="," file

Will not work in this case

Just now i tried with tr command it's removing the end of space each line..

Another approach:

awk '$1=$1' OFS= file

In vi:

:%s/ //g