4 ms·
Almost, but not quite :) $ ls | grep '.csv$' | xargs cat | grep 'cake' | cut -d, -f2,3 cake cake cake $ grep cake *.csv | cut -d, -f2,3
by darrenf 5y ago
Almost, but not quite :)
$ ls | grep '.csv$' | xargs cat | grep 'cake' | cut -d, -f2,3
cake
cake
cake
$ grep cake *.csv | cut -d, -f2,3
bar.csv:cake
foo.csv:cake
quux.csv:cake
`grep -h` will do the trick though
- darrenf 5y agoI'm surprised, hours later, that no-one has pointed out my error here! So I'll do it myself - upon revisiting it, I realised my input files weren't CSVs with the number of fields required for `cut` to do the intended thing. Had I made them so, the `-h` isn't required after all. My bad :)