Skip to content

Instantly share code, notes, and snippets.

@hatamiarash7
Last active February 17, 2023 13:49
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 hatamiarash7/6a6cc71616e85ce66d8c95336e1810b8 to your computer and use it in GitHub Desktop.
Save hatamiarash7/6a6cc71616e85ce66d8c95336e1810b8 to your computer and use it in GitHub Desktop.
Bash Slugify string

How to create slug text in bash

We can use this command:

echo "My awesome title" | iconv -t ascii//TRANSLIT | sed -r 's/[~\^]+//g' | sed -r 's/[^a-zA-Z0-9]+/-/g' | sed -r 's/^-+\|-+$//g' | sed -r '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