5 ms·
Often I find myself dealing with tab-separated files; and cat -n is very handy there. To see which columns a particular value occurs in: awk -F'\t' < tsv
by ajays 15y ago
Often I find myself dealing with tab-separated files; and cat -n is very handy there.
To see which columns a particular value occurs in:
awk -F'\t' < tsv-file | tr '\t' '\n' | cat -n | grep something
- veyron 15y agoFYI you can add line numbers (cat -n behavior) within awk directly as so: awk '{print NR, $0}'
- gnosis 15y agoThe nl command (part of coreutils) is specifically written for numbering lines. It can do simple line numbering, along with various other styles and formats. Its man page can be seen here: http://linux.die.net/man/1/nl http://linux.die.net/man/1/nl
- veyron 15y agoawk's sprintf can do all of that. Not saying it's the right tool for the job, but the parent did have a pipeline already using awk.
- Hemospectrum 15y agoIs there a version of awk that has interesting default behavior when you leave out the program like that?