Created
January 30, 2015 17:19
-
-
Save cjlyth/f511100cbc00b775a480 to your computer and use it in GitHub Desktop.
sed snippet to replace all regex matches in a string with som eother char
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable="a b a b a x x" | |
echo $variable | |
echo $variable | sed -r '/[^[:alnum:]]+/{s/[^[:alnum:]]/_/g}' | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment