Usage demo • Installation • Command-line completion • Usage • Contributing • License
uc
is a simple utility for counting unique lines.
$ wc -l data.txt
18408096 data.txt
$ hyperfine 'sort -u data.txt | wc -l' 'uc -np data.txt'
Benchmark 1: sort -u data.txt | wc -l
Time (mean ± σ): 16.030 s ± 0.181 s [User: 86.713 s, System: 1.165 s]
Range (min … max): 15.699 s … 16.324 s 10 runs
Benchmark 2: uc -np data.txt
Time (mean ± σ): 2.889 s ± 0.101 s [User: 2.435 s, System: 0.454 s]
Range (min … max): 2.721 s … 3.065 s 10 runs
Summary
uc -np data.txt ran
5.55 ± 0.20 times faster than sort -u data.txt | wc -l
To build the uc
from scratch, make sure you have a working Go 1.20+ workspace (instructions), then:
go install github.com/essentialkaos/uc@latest
sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
sudo yum install uc
You can download prebuilt binaries for Linux from EK Apps Repository.
To install the latest prebuilt version, do:
bash <(curl -fsSL https://apps.kaos.st/get) uc
You can generate completion for bash
, zsh
or fish
shell.
Bash:
sudo uc --completion=bash 1> /etc/bash_completion.d/uc
ZSH:
sudo uc --completion=zsh 1> /usr/share/zsh/site-functions/uc
Fish:
sudo uc --completion=fish 1> /usr/share/fish/vendor_completions.d/uc.fish
You can generate man page for uc
using next command:
uc --generate-man | sudo gzip > /usr/share/man/man1/uc.1.gz
Branch | Status |
---|---|
master |
|
develop |
Before contributing to this project please read our Contributing Guidelines.