Unix: Chopping up CSV files

CSV (comma-separated values) files represent a common standard for transmitting data between applications. Like the more generic "flat files", each line in a CSV file represents a record. Exporting or importing data from and to applications such as Excel in CSV format is standard practice for a lot of applications. Hand a CSV file to a tool such as awk, however, and you may run into some problems. Let's look at the problems and at a handy Perl module that takes the stress out of working with CSV files on Unix systems.

By  

And, note, that you can use another character -- maybe a | or a # if colons don't work for you. Just replace the : characters in the script to the character of your choice. Text::CSV takes the pain out of parsing complex CSV files.

Read more of Sandra Henry-Stocker's Unix as a Second Language blog and follow the latest IT news at ITworld, Twitter and Facebook.

Photo Credit: 

flickr / TripleScoop

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question