Re: HOW in the HECK can we import comma quote delimted ASCII !!!????
Posted in 1995
Here are a couple of awk scripts : # c2ascii # converts comma delimited files with optional quotes to std informix unload # assumes no "|" symbols in text ! { for (a=1;a<=length($0);) if ((ch=substr($0,a++,1))=="\\"") isquote=isquote?0:1 else printf("%s",(ch==","&&isquote==0)?"|":ch) print "" } # c2informix # converts unload format files to comma delimited quoted output files # all lines must end in a "|" { z="" for (b=1;b<split($0,a,"|");b++) (match(a[b],"[^0-9\\. \\-]")||a[b]=="")?(z=z "\\"" a[b] "\\","):(z=z a[b] ",") print substr(z,1,length(z)-1) } To run them use something like: awk -f c2informix myfile.asc > newfile.unl awk -f c2ascii myfile.unl > newfile.asc Note: You may need to use nawk on some machines! -- Mike Aubury Senior Technical Consultant