Skip to content

igorwwwwwwwwwwwwwwwwwwww/topk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

topk

A small utility for ad-hoc top-k analysis built in go.

Install

$ go install github.com/igorwwwwwwwwwwwwwwwwwwww/topk@latest

Usage

You can pass a filename:

$ topk types.txt
Water        112  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Normal        98  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Grass         70  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Bug           69  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Psychic       57  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Fire          52  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Rock          44  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Electric      44  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Ghost         32  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Dragon        32  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎

$ topk -other types.txt
Water        112  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Normal        98  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Grass         70  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Bug           69  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Psychic       57  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Fire          52  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎
Rock          44  ∎∎∎∎∎∎∎∎∎∎∎∎
Electric      44  ∎∎∎∎∎∎∎∎∎∎∎∎
Ghost         32  ∎∎∎∎∎∎∎∎
Dragon        32  ∎∎∎∎∎∎∎∎
OTHER        191  ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎

Alternatively, it's also possible to pipe from stdin:

$ cat types.txt | topk

For approximate results using the filtered space-saving algorithm, you can pass -approx:

$ topk -approx types.txt

Why

Because my fingers hurt from typing sort | uniq -c | sort -rn | head.

Similar to

License

MIT.

About

A small utility for ad-hoc top-k analysis built in go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors