/scount

A command-line streaming counter with real time progress reports, which is an alternative to `sort | uniq -c`

Primary LanguageGoApache License 2.0Apache-2.0

scount: a command-line streaming counter with rich progress report

See https://github.com/oshikiri/count.pl


Build Status go report release

You can use it instead of sort | uniq -c.

cat ./demo/text8 | tr ' ' '\n' | scount -a | \
    jq '. | sort_by(.count) | reverse | .[0:3]'

demo animation: approximate count using text8

Installation

Using binary

See https://github.com/oshikiri/scount/releases.

From source code

go get github.com/oshikiri/scount
go install github.com/oshikiri/scount

and then add ~/go/bin to $PATH.

Usage

$ scount -h
Usage of scount:
  -a    Use approximate counting algorithm (default is naive counting)
  -ae float
        Epsilon of lossy counting algorithm (default 1e-05)
  -as float
        Support of lossy counting algorithm (default 2e-05)
  -f int
        Flush counting progress every X [msec] (default 200)
  -n int
        Print the top N items (default 10)
  -q    Suppress a progress report

Development

# Create ./scount binary
go build

# Run tests
go test