Parsing a CSV Data File

Problem

You have a Comma Separated Values (CSV) data file that you need to parse.

Solution

Unlike the previous recipe for converting to CSV, there is no easy way to do this, since it’s tricky to define exactly what CSV really means.

Possible solutions for you to explore are:

Discussion

As noted in Converting a Data File to CSV, there is no formal specification for CSV, and that fact, combined with data variations, makes this task much harder than it sounds.

Get bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.