Remove spaces from the file

Hi All,

The output file contains data as below.

"20141023","CUSTOMER" ,"COMPANY" ,"IN0515461"      ,""     ,"JOSHUA"

There are spaces in between the ending " and ,. The number of spaces is random.

How can I remove that from the file so that the final output is:

"20141023","CUSTOMER","COMPANY","IN0515461","","JOSHUA"

Thanks,
Aarsh

try:

sed 's/"  *,/",/g' output_file > output_file.fixed
tr -d ' ' <in_file >out_file

That would remove any space and the OP is requesting only some specific instance.

It was stable for the data shown. That sed solution misses spaces at end of line.

sed '
    s/"  *,/",/g
    s/  *$//
 ' output_file > output_file.fixed