4 ms·
Is that better than: cut -d, -f1,3 data.csv | grep -v '^foo' I'm sure there are some things where you need sql/q, but this isn't one of them, and there is a
by tacostakohashi 5y ago
Is that better than:
cut -d, -f1,3 data.csv | grep -v '^foo'
I'm sure there are some things where you need sql/q, but this isn't one of them, and there is a lot of utility in productive with bare POSIX tools.
- forgetfulness 5y agoExpressing an 'or' or having any logic to the condition becomes quickly annoying with usual *nix tools, and most people use SQL much more often than they forget how to use sed and awk.
- tacostakohashi 5y agoegrep '(a|b)'
- burntsushi 5y agoIf always splitting on ',' is correct for your data, then your solution is probably fine. You probably want '^foo,' though, otherwise yours includes things where 'foo' is just a prefix of the first column value. But CSV permits quoted fields that contain literal ','. So in that case, splitting on ',' would be incorrect.
- timeinput 5y agoThis breaks down when you have commas in your CSV data like if you had something like locations as the quoted string "Atlanta, GA"