freq

command module
v0.0.0-...-4de28ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2019 License: MIT Imports: 10 Imported by: 0

README

freq

Command-line utility application for displaying frequencies as histograms or bar charts, from the standard input.

For text input, freq returns a bar chart:

$ cat file.txt | freq
bar  ██████████▏ 1
foo  ████████████████████▏ 2
test ██████████████████████████████▏ 3

For numerical datasets, add the --histogram option to display a frequency distribution:

$ cat dataset.txt | freq --histogram --justify
  2-3 █████ 28
  3-4 █████████████████████████████▌ 167
  4-5 ██████████████████████████████▏ 170
  5-6 ████████████████████████████▌ 161
  6-7 █████████████ 73
  7-8 ██████████▌ 59
  8-9 █████████▎ 52
 9-10 ████▋ 26
10-11 ███▏ 17
11-12 ██▊ 15

Installation

go get github.com/marcusolsson/freq

Usage

Show top contributors to a Git repository:

git --no-pager log --format='%aN' | freq

Show most frequently used words in a document:

cat file.txt | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr '[:space:]' '\n' | freq

Show distribution of word lengths in a document:

cat file.txt | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr '[:space:]' '\n' | xargs -I'%' -n1 sh -c "echo % | wc -m" | freq --histogram

Show distribution of pull request age for a GitHub project, using hub:

hub pr list -s opened -f '%ct%n' | xargs -n1 -I'{}' sh -c 'echo $(($(date +%s)-{}))' | freq --histogram --buckets=20

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL