Created
September 22, 2014 18:58
-
-
Save HBBisenieks/c771892e3633c32c5085 to your computer and use it in GitHub Desktop.
Get basic statistics on unique and repeated words from a plaintext file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "$1 is `wc -w $1 | awk '{print $1}'` words long." | |
echo "It contains `cat $1 | awk '{ for (i=1; i<=NF; i++) print $i }' | sed -e 's/[,.;-*?"]//g' | tr A-Z a-z | sort | uniq | wc -w` unique words." | |
echo "It contains `cat $1 | awk '{ for (i=1; i<=NF; i++) print $i }' | sed -e 's/[,.;-*?"]//g' | tr A-Z a-z | sort | uniq -d | wc -w` words that are repeated at least once." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment