Skip to content

Instantly share code, notes, and snippets.

@decrn
Last active May 22, 2019 08:12
Show Gist options
  • Save decrn/8f6454f514f481b5f5bd9df33e4e221e to your computer and use it in GitHub Desktop.
Save decrn/8f6454f514f481b5f5bd9df33e4e221e to your computer and use it in GitHub Desktop.
# !bin/sh
# groups words by most common occurence and highlights colon emojis e.g. :slighty_smiling_face:
# useful in combination with e.g. a message scraper for Slack
# macOS? brew install gnu-sed to swap casing
# change all seds to gsed or add it to your PATH
# ps coreutils is bloatware
echo 'some random random text :stuckouttongue:' \
| tr '[:upper:]' '[:lower:]' \
| sed 's/[\w \W \s]*http[s]*[a-z0-9 : \. \/ ; % " \W]*/ /g' \
| tr '[:space:]' '[\n*]' \
| sed 's/:\S*:/\U&/g' \
| sed 's/[[:punct:]]//g; s/[[:space:]]/\n/g' \
| grep -v "^\s*$" \
| sort \
| uniq -c | sort -bn
| sed 51q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment