#!/bin/bash input="" echo "Please enter 15 lines of words" for i in {1..15} do read -r line input+="$line " done echo "$input" | tr ' ' '\n' | awk '{print tolower($0)}' | sort | uniq -c | sort -nr | awk '{ print $2, $1 }'