Skip to content

Bash script to show simple character-distribution histograms

License

Notifications You must be signed in to change notification settings

perihelios/histchar-bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

histchar (Bash)

This is a simple script to show columnar histograms of character distributions in data. It was intended for a fairly specific analysis problem, so will likely require some adaptation for other uses.

Usage

You can pipe data into the script:

dd if=/dev/urandom bs=1000 count=1 status=none | od -t x1 -A n | ./histchar.sh {0..9} {a..f}

Or you can just run it and enter data in the terminal:

./histchar.sh A B C
AAAAABB
CCCCCCCCC
DD<Ctrl+D>

Note that you press the <Ctrl+D> key combination to end input.

Output scales itself horizontally to terminal width, and vertically to half terminal height.

Limitations

  • Whitespace characters are always ignored
  • Binary data won't work extremely well, due to Bash's inability to hold a null byte in a string
  • The EOT character (0x04) is used to indicate end-of-data, as this allows the <Ctrl+D> combination to terminate manual input

About

Bash script to show simple character-distribution histograms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages