2 ms·
> uniqc is a handy alias I use to left-justify and tab-separate the tally numbers from uniq -c: alias uniqc="uniq -c | sed 's/^[ ]*//;s/ /\t/'" I did this exac
by effie 8y ago
> uniqc is a handy alias I use to left-justify and tab-separate the tally numbers from uniq -c: alias uniqc="uniq -c | sed 's/^[ ]*//;s/ /\t/'"
I did this exact thing down to the name of the alias few years ago. The choice of space characters as separator in the uniq command is hard to understand. Is this a case of a design flaw turned feature?
- barrkel 8y agoMost people find right-aligned numbers easier to scan than left-aligned numbers. Most tabular representations of numbers use right-alignment; disk usage listings, spreadsheets, SQL command prompts, etc. If I want to sort the output of `uniq -c`, I use `sort -n`, which knows about numbers even if they're left aligned. If I want to extract out the number to do something with it, I use `awk`. I think right alignment is the correct default.