# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
intext ='"co\nl1"\t"col  2"\t"co\nl3"\t"cos~l4" \n "co  dsl21"\t"co_<l22"\t"col2cx3"\t"cofdsl24"'
print intext
text = ''
inq = False
for c in intext:
    if c == '"':
        if not inq and not text.endswith('\n'):
            text += ','
        text += c
        inq = not inq
    elif c == '\n':
        if not inq:
            text += c
    else:
        if inq:
            text += c
print text
