4 ms·
> Does `cut -f2` not work? Most utilities don't use a tab character as separator, and that's what cut operates to by default. Can't cut on whitespace in genera
by masklinn 7y ago
> Does `cut -f2` not work?
Most utilities don't use a tab character as separator, and that's what cut operates to by default. Can't cut on whitespace in general, which is what's actually useful, and what awk does.
Only way to get cut to work is to add a tr inbetween, which is a waste of time when awk just does the right thing out of the box.
- cauthon 7y ago> which is a waste of time when awk just does the right thing out of the box. Agree in general. Only exception I'd make to this is when you're selecting a range of columns, as someone else mentioned elsewhere in the thread. I typically find (for example) `| sed -e 's/ \+/\t/g' | cut -f 1,3-10,14-17` to be both easier to type and easier to debug than typing out all the columns explicitly in an awk statement.
- b215826 7y agoInstead of piping to sed, I would simply use | tr -s ' ' '\t'