Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. # This version replaces multiple hyphens with a single hyphen
  2. echo "$STRING" | iconv -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z
  3.  
  4. # This version maintains the number of hyphens
  5. echo "$STRING" | iconv -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9-]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement