Created
March 6, 2015 19:58
-
-
Save ChicagoDev/b5332d47a2b970a312ca to your computer and use it in GitHub Desktop.
Formatting parentheses in Sed
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
# needs to be executed with the expanded REGEX synatax -E flag | |
# sed -Ef script.sed parenthesesFile.txt | |
s/ *\(/ \(/g; | |
s/\) */\) /g; | |
s/\(\)/\( \)/g; | |
s/\(\(/\( \(/g; | |
s/\)\)/\) \)/g; | |
s/\(([a-zA-Z0-9])/( \1/g; | |
s/([a-zA-Z0-9])\(/\1 (/g; | |
s/\( +\)/\( \)/g; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment