Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcusolsson/freq
Display frequency distributions from the command-line.
https://github.com/marcusolsson/freq
Last synced: 1 day ago
JSON representation
Display frequency distributions from the command-line.
- Host: GitHub
- URL: https://github.com/marcusolsson/freq
- Owner: marcusolsson
- License: mit
- Created: 2019-10-18T21:35:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-19T11:42:04.000Z (about 5 years ago)
- Last Synced: 2024-06-20T17:40:03.572Z (5 months ago)
- Language: Go
- Size: 32.2 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```shell
$ cat file.txt | freq
bar ██████████▏ 1
foo ████████████████████▏ 2
test ██████████████████████████████▏ 3
```For numerical datasets, add the `--histogram` option to display a frequency distribution:
```shell
$ 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
```bash
go get github.com/marcusolsson/freq
```## Usage
Show top contributors to a Git repository:
```bash
git --no-pager log --format='%aN' | freq
```Show most frequently used words in a document:
```bash
cat file.txt | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr '[:space:]' '\n' | freq
```Show distribution of word lengths in a document:
```bash
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](https://hub.github.com/):
```
hub pr list -s opened -f '%ct%n' | xargs -n1 -I'{}' sh -c 'echo $(($(date +%s)-{}))' | freq --histogram --buckets=20
```