Skip to content

Instantly share code, notes, and snippets.

@beryllium
Forked from oneohthree/quick-slugify.sh
Last active December 7, 2016 07:54
Show Gist options
  • Save beryllium/f500f7548ae9843c823af8005eed2201 to your computer and use it in GitHub Desktop.
Save beryllium/f500f7548ae9843c823af8005eed2201 to your computer and use it in GitHub Desktop.
Quick bash slugify
# Updated to work on OS X (convert both "-E" flags to "-r" to run on real server OSes)
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -E s/[^a-zA-Z0-9]+/-/g | sed -E s/^-+\|-+$//g | tr A-Z a-z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment