import sys

# Converts a -mas.dat into a .csv file

replacements = {' "':",",'"':'','  ':',',' -':',-'}

infile = sys.argv[1]
outfile= infile[:-8]+".csv"

with open(infile) as infile, open(outfile, 'w') as outfile:
    for line in infile:
        for src, target in replacements.items():
            line = line.replace(src, target)
        outfile.write(line[1:])
