Skip to content

Instantly share code, notes, and snippets.

@dreikanter
Created June 15, 2022 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreikanter/6cdd11d084a1dc4e927a4548ede93e08 to your computer and use it in GitHub Desktop.
Save dreikanter/6cdd11d084a1dc4e927a4548ede93e08 to your computer and use it in GitHub Desktop.
A script to extract hashtags from stdin

Usage example:

echo "#banana #banana #ololo #un_der-sco_re #по-русски #123" | ./extract_hashtags
#123
#banana
#ololo
#un_der-sco_re
#по-русски
#!/usr/bin/env ruby
puts STDIN.read.to_s.scan(/\B#[[[:alpha:]][[:digit:]]\-_]+/).sort.uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment