in the outputfile that I get, some of the lines begin with a , and some don't. obviouswly this makes manipulating the data by columns tricky. so I added another sed search-and-replace statement that would delete a coma if it was at the beginning of a line:
sed 's/ //g;s/,,*/,/g;s/^,//g'...