@kszongic/tally-cli
v1.0.0
Published
Count occurrences of each line from stdin — like sort | uniq -c but cross-platform and sorted by frequency
Maintainers
Readme
@kszongic/tally-cli
Count occurrences of each line from stdin — like sort | uniq -c but cross-platform, zero dependencies, and sorted by frequency.
Install
npm i -g @kszongic/tally-cliUsage
# Count word frequency
echo -e "apple\nbanana\napple\napple\nbanana\ncherry" | tally
# 3 apple
# 2 banana
# 1 cherry
# Top 2 most frequent
cat access.log | tally --top 2
# Sort alphabetically
cat words.txt | tally --name
# Ascending order
cat data.txt | tally --asc
# Custom delimiter
cat items.txt | tally -d ","Options
| Flag | Description |
|------|-------------|
| -a, --asc | Sort ascending instead of descending |
| -n, --name | Sort alphabetically by line text |
| -t, --top N | Show only the top N entries |
| -d, --delimiter | Delimiter between count and text (default: tab) |
| -h, --help | Show help |
| -v, --version | Show version |
Real-world examples
# Most common HTTP status codes
awk '{print $9}' access.log | tally --top 5
# Most used shell commands
history | awk '{print $2}' | tally --top 10
# Count file extensions in a directory
find . -type f | sed 's/.*\.//' | tallyLicense
MIT © 2026 kszongic
