Scripting Question
Derek Broughton
derek at pointerstop.ca
Mon Feb 16 15:43:12 UTC 2009
Steve Lamb wrote:
> Derek Broughton wrote:
>> Hal Burgiss wrote:
>>> cut -d, -f2,4,57,59,61 $csvfile |grep @
>
>> Cute :-) There's always another, simpler, way...
>
> Except, as pointed out, when there are embedded commas in a field.
> That is why none of the people suggesting Python suggested using
> split(','). Do that once with a CSV with embedded commas and you go
> running to you local Python documentation to read up on the csv module.
Well, I _was_ one of the people who suggested python. Cut's a very good
solution if you can rely on your data not having embedded commas. I spent
a long time working on reading csv files for an application, and pretty
well _every_ solution other than python's csv module fell apart in this
case.
More information about the ubuntu-users
mailing list