[NTLUG:Discuss] scripting foo help

Dan Wright - SPCA of Texas dwright at spca.org
Wed Jul 8 15:33:47 CDT 2009


 
> Well, assuming that there are 17 columns (if I counted 
> correctly) already comma-separated and none of them already 
> have double quotes, here's an awk script:
> 
> BEGIN {FS=","; OFS="\",\""}
> {print "\"" $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, 
> $12, $13, $14, $15, $16, $17 "\"";}
> 
> Let's call it pet.awk for the sake of discussion and assume 
> the input file is named pets.csv and the output file 
> pets.out.  The command line is:
> 
> gawk -f pet.awk pets.csv > pets.out
> 
> It's not a particularly elegant script but it gets the job done.


Leroy your foo or is it fu is strong ...thanks for the help.....Dan



More information about the Discuss mailing list