Skip to content

stefanhengl/histogram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

histogram

license

Compute and display histograms in the terminal.

Histogram is 100% awk. It takes a stream of numbers and outputs a histogram with user-defined bins.

$ histogram -v b=0:800:50 < data.csv

The output is the following

  0 -  50: ██████████████████████████████████████████████████ (5104)
 50 - 100: ████████████████ (1643)
100 - 150: ██████████ (1021)
150 - 200: █████▊ (599)
200 - 250: ████ (416)
250 - 300: ███▌ (349)
300 - 350: ██▎ (242)
350 - 400: █▊ (172)
400 - 450: █▎ (127)
450 - 500: ▊ (76)
500 - 550: ▌ (63)
550 - 600: ▌ (50)
600 - 650: ▎ (35)
650 - 700: ▎ (24)
700 - 750: ▎ (16)

To print bins from large to small, reverse the range and use a negative step size (here -50).

$ histogram -v b=300:-1:-50 < data.csv

The output is the following:

250 - 300: ███▌ (349)
200 - 250: ████ (416)
150 - 200: █████▊ (599)
100 - 150: ██████████ (1021)
 50 - 100: ████████████████ (1643)
  0 -  50: ██████████████████████████████████████████████████ (5104)

Usage

histogram -v b=RANGE [-v scale=SCALE]

RANGE   from:to:step (Python style)  
SCALE   postive integer (DEFAULT=50)

Install

curl -o /usr/local/bin/histogram https://raw.githubusercontent.com/stefanhengl/histogram/master/histogram
chmod +x /usr/local/bin/histogram

About

Compute and display histograms in the terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages