On Thu, Mar 18, 2010 at 09:16:30AM -0700, Mattias Thorslund wrote: > Paul M Foster wrote: >> I process a lot of CSV files, and what I typically see is that Excel >> will enclose fields which might contain commas in quotes. This gets >> messy. So I finally wrote a C utility which parses the file and yields >> tab-delimited records without the quotes. >> >> Paul >> > > And fgetcsv() didn't work for you? > > http://www.php.net/fgetcsv I wrote my utility (and the infrastructure to process these files) long before I was working with PHP. For what I do with the files, I must pipe one operation's results to another process/command to get the final result. This is impossible with web-based PHP. So I shell out from PHP to do it. Like this: // convert original file to tab-delimited cat maillist.csv | cqf | filter.cq3or4 > jones.tab // filter unwanted fields and reorder fields mlt3.py nady jones.tab jones.rdb // build basic DBF file dbfsak -r mailers.rdb jones.dbf // append rdb records to DBF file dbfsak -a jones.rdb jones.dbf Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php