name: sort-uniq-count description: Use when counting nonblank text lines after an internal sort, especially when you want case-insensitive grouping in a compact shell wrapper. disable-model-invocation: true user-invocable: true
sort-uniq-count
Shell pipeline wrapper that removes blank lines, sorts the stream, groups identical lines case-insensitively with uniq -i -c, and rewrites the result as tab-delimited count<TAB>value.
Quick Start
- Command:
... | sort-uniq-count [bfinrs] - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/sort-uniq-count - Default sort flag bundle:
f
When To Use This Tool
- Counting repeated nonblank lines without manually composing
sort | uniq -c | awk - Performing case-insensitive frequency summaries on text streams
- Applying a small subset of GNU
sortflags before counting - Producing tab-delimited count tables for later ranking or filtering
Common Patterns
# Default case-insensitive counting
printf 'beta\nAlpha\nalpha\nbeta\n' | sort-uniq-count
# Numeric pre-sort before counting
printf '10\n2\n2\n' | sort-uniq-count n
# Reverse sort before counting
cat values.txt | sort-uniq-count r
Recommended Workflow
- Feed the wrapper a one-item-per-line text stream.
- Pass only the compact flag letters it understands (
bfinrs) when you need to alter the internalsort. - Capture the resulting
count<TAB>valuetable or pipe it intosort-uniq-count-rank. - Treat the output as case-insensitive counts unless you have inspected the shell pipeline and intentionally changed it.
Guardrails
- The wrapper sorts internally, so the input does not need to be pre-sorted; the old “sorted input required” assumption is wrong.
- Counting is case-insensitive because the pipeline always uses
uniq -i -c, and the default sort mode is-f. - It does not implement real help/version flags. For example,
--versionwas mangled into sort-option letters and locally failed withsort: options '-in' are incompatible. - Unrecognized user arguments are stripped down to the subset
[bfinrs]; if none survive, the wrapper falls back tosrather than erroring cleanly. - In local testing,
printf 'beta\nAlpha\nalpha\nbeta\n' | sort-uniq-countproduced two rows:2\tAlphaand2\tbeta.