1 changed file
.gitignore | ||
Add comment 23 # shellcheck disable=SC2034,SC2154
Add comment 24 usage_description="
Add comment 25 Creates a word freqency list ranked by most used words at the top
Add comment 26 Plus
Add comment 27 Plus Works like a standard unix filter program - pass in stdin or give it a filename, and outputs to stdout, so you can continue to pipe or redirect to a file as usual
Add comment 26 28 "
Add comment 27 29
Add comment 28 30 # used by usage() in lib/utils.sh
Add comment 29 31 # shellcheck disable=SC2034
Add comment 30 Minus usage_args="<filename> [<options>]"
Add comment 32 Plus usage_args="[<filename>]"
Add comment 31 33
Add comment 32 34 help_usage "$@"
Add comment 33 35
Add comment 34 Minus min_args 1 "$@"
Add comment 36 Plus #min_args 1 "$@"
Add comment 35 37
Add comment 36 Minus filename="$1"
Add comment 38 Plus #filename="$1"
Add comment 39 Plus
Add comment 40 Plus if [ $# -eq 0 ]; then
Add comment 41 Plus echo "Reading from stdin" >&2
Add comment 42 Plus fi
Add comment 37 43
Add comment 38 44 #output_file="$filename.word_frequency.txt"
Add comment 39 45
Add comment 40 Minus tr ' ' '\n' < "$filename" |
Add comment 46 Plus # one of the few legit uses of cat - tr can't process a filename arg or stdin
Add comment 47 Plus cat "$@" |
Add comment 48 Plus tr ' ' '\n' |
Add comment 41 49 sed '
Add comment 42 50 /^[[:space:]]*$/d;
Add comment 43 51 # because sometimes you want to see the occurence of emojis in WhatsApp chats