Skip to content

Instantly share code, notes, and snippets.

@bougui505
Created January 10, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bougui505/9846e4efde9afee2e48397e7faa04ab0 to your computer and use it in GitHub Desktop.
Save bougui505/9846e4efde9afee2e48397e7faa04ab0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# -*- coding: UTF8 -*-
# Author: Guillaume Bouvier -- guillaume.bouvier@pasteur.fr
# https://research.pasteur.fr/en/member/guillaume-bouvier/
# 2020-01-10 16:20:44 (UTC+0100)
# Simple bar chart plotting in a terminal by reading integer from stdin
# FIELD: Field number to read the value from
if [ "$#" -ne 1 ]; then
FIELD=1
else
FIELD=$1
fi
cat /dev/stdin | awk -v FIELD=$FIELD '{printf $0" "; for (i=1;i<=$FIELD;i++){printf "+"};printf "\n"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment