Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@diraol
Forked from oneohthree/quick-slugify.sh
Last active February 17, 2019 13:46
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 diraol/26be250e220b1315cf652017c35b0c0c to your computer and use it in GitHub Desktop.
Save diraol/26be250e220b1315cf652017c35b0c0c to your computer and use it in GitHub Desktop.
Quick bash slugify
# POSIX Compatible
# Remove leading and trailing spaces and dashes
# also zsh compatible
echo " - - Esperança do vôo do avião - - " | iconv -t ascii//TRANSLIT | sed -E 's/[~\^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+\|-+$//g' | sed -E 's/^-+//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