4 ms·
What cauthon said, cut lets you select range of fields with a simple option, awk doesn't, ex(csv line): cut -d, -f10-30 (selects from field 10 to 30) Not s
by Scarbutt 7y ago
What cauthon said, cut lets you select range of fields with a simple option, awk doesn't, ex(csv line):
cut -d, -f10-30
(selects from field 10 to 30)
Not saying this can't be written in awk with more code, but we were talking about field selection ergonomics.
- ColinWright 7y agoOK, understood. And yes, in my experience AWK is less good at that, cut would definitely be the right tool. It doesn't detract from the point at hand - which is perfectly valid - but it's worth noting that there's a confusion here with regards the terminology: "fields" vs "columns". I thought they were referring to "columns of characters" whereas the added explanations[0] are about "columns of fields". That makes a difference. But as I say, yes, I agree that to select a range of columns of fields, especially several fields from each line, is definitely better with cut. [0] https://news.ycombinator.com/item?id=22109551 https://news.ycombinator.com/item?id=22109551