News for hackers. Stuff that matters.
Re:The Economics of Clean Code by burntsushi on Tuesday February 11, 2020 @11:55AM (#22299971)
> Well, no, you can do exactly that in a single line with tail, head, split and cat.

You can't, because csv records may span multiple lines. So dicing them with standard tools may subtly break them. Unless you know your particular CSV data only has single line records.

(I take your broader point though. It's just that CSV is a bad example, because you usually wind up needing specialized tools to deal with them. It's likely that your PHP script would actually be more correct!)

Re:The Economics of Clean Code by CaptArmchair on Wednesday February 12, 2020 @03:26AM (#22306985)
Thanks for clarifying that overlooked detail.

I should have mentioned another lesson for junior developers: learn to understand the structure of your data and avoid making assumptions about formatting.

Re:The Economics of Clean Code by mynegation on Tuesday February 11, 2020 @12:18PM (#22300229)
Thank you for xsv and other things, Andrew.

To GP: also - CSV headers. Still possible in one line of shell, but it is starting to get unwieldy.