Wrapping Up
In the real world, most of the plain-text files we’ll encounter won’t be chaotic and unstructured. Delimited files, like CSVs, are far more common. Practically every database, spreadsheet program, or web service imports data from or exports data to CSV format, so parsing it is essential. We explored how to parse these structures ourselves for simple formats like TSV, but also how to use Ruby’s built-in CSV library to take the hard work out of processing the more complex CSV format.
We also saw how we could adapt our shell one-liners to delimited data by passing the -F and -a options to the Ruby interpreter, allowing us to explore delimited data in ad hoc scripts from the command line.
The next step in our processing journey increases ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access