Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Variable to store total word count
- words=$(wc $1 | awk '{print $2}')
- count=$(grep -c "$2" "$1")
- echo "Word Count:" $words
- echo "Instance count of "$2": "$count
- percentage=$(expr $count / $words)
- echo $percentage
Add Comment
Please, Sign In to add comment