handle URLs
This commit is contained in:
parent
d8f5f6f926
commit
fc5825abba
5629
blabla.txt
Normal file
5629
blabla.txt
Normal file
File diff suppressed because it is too large
Load Diff
16
top_words.sh
16
top_words.sh
@ -1,3 +1,13 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
BASEDIR=$(dirname "$0")
|
set -o errexit
|
||||||
grep -o -E '[a-zA-Z]{3,}' "$BASEDIR/README.md" | tr A-Z a-z | grep -vwFf stopwords.txt | sort | uniq -c | sort -n
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
url="${1:-}"
|
||||||
|
basedir=$(dirname "$0")
|
||||||
|
|
||||||
|
if [[ "${url:-}" = "" ]]; then
|
||||||
|
grep --only-matching --extended-regexp '[a-zA-Z]{3,}' "$basedir/README.md" | tr '[:upper:]' '[:lower:]' | grep --invert-match --word-regexp --fixed-strings --file=stopwords.txt | sort | uniq --count | sort -n
|
||||||
|
else
|
||||||
|
curl "$url" | grep --only-matching --extended-regexp '[a-zA-Z]{3,}' | tr '[:upper:]' '[:lower:]' | grep --invert-match --word-regexp --fixed-strings --file=stopwords.txt | sort | uniq --count | sort -n
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user