Thursday, September 25, 2008

Mike MacCana’s VentureCake - The 5 lines that mystified O’Reilly - how to use a spreadsheet in bash

You should read Mike MacCana’s post "The 5 lines that mystified O’Reilly: how to use a spreadsheet in bash". NOTE: I took down the link as it is now parked. Venture Cake appears to be gone.

Given that I just reviewed the Bash Cookbook mentioned in Mike's post, I was really happy to find this elegant solution to the problem of processing comma separated value (CSV) files with a simple bash script which doesn't appear in its pages.

It isn't an all purpose solution by any means, but a useful one if you need to expand on it. Some discussion of its finer good points and failings can be found on the Hacker News post that alerted me to it in the first place.

4 comments:

Unknown said...

Be very careful with that solution, it works great in the trivial case but will corrupt your output with ugly, "real world" CSV containing things like in-field commas (e.g., "Acme, Inc."). See the comments in the original blog post for more discussion.

--JP (_bash Cookbook_ co-author)

Jim said...

Thanks, JP.

I completely agree with your point.I think the title of the original post is a bit inflammatory, but it could be a useful solution given caveats like those that you mention.

Thanks for making that more clear.

brian said...

Clicking on the first link in this post generates a 404 error for me. I can still go get it myself, but just wanted to point it out. Thanks for the pointer.

Jim said...

@brian

Looks like Mike MacCana's site is down. It was a good article.