Skip to content

Instantly share code, notes, and snippets.

@plasticine
plasticine / slugify
Last active September 20, 2022 13:42
Slugify strings in bash with awk
#!/usr/bin/env bash
#
# Accepts an input string and slugifies it by replacing anything non-alphanumeric with a dash.
#
# Example;
#
# $ slugify "foo bar hello/world"
# > foo-bar-hello-world
#
# $ echo "foo bar hello/world" | slugify