Created
February 3, 2014 17:46
-
-
Save jmervine/8788669 to your computer and use it in GitHub Desktop.
Strip specials in BASH
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
# replaces numbers, commas, periods, asterisks, slashes (forward and back), all brackets and parentheses | |
# | |
# note: I'd like to get this working with less '-e' calls but it wasn't for me on | |
# | |
# $ sed --version | |
# GNU sed version 4.2.1 | |
sed -r -e 's/[0-2,\.\*\\\/]/_/g' -e 's/\[/_/g' -e 's/\]/_/g' -e 's/\{/_/g' -e 's/\}/_/g' -e 's/\(/_/g' -e 's/\)/_/g' -e 's/_{2,}/_/g' -e 's/_$//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment