Last active
August 29, 2015 13:58
-
-
Save mchinen/10437124 to your computer and use it in GitHub Desktop.
WIP shell script to fix slightly off indentation of control statements (for mac)
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
#!/usr/bin/env bash | |
# Cleans up almost k&r formated control statements to nicer ones, e.g. | |
# if (something){ -> if (something) | |
# while(something){ -> while (something) { | |
# | |
# Probably doesn't work on lots of things and has holes and will destroy your computer, use at your own risk. | |
# It worked for me on two files | |
# | |
# Usage: | |
# ./thenameofthisfile.sh MyInputFileThatIsSupposedToBeKR.c | |
sed -E -i -e 's/(if|while|else if|for) ?\((.*)\) ?{/\1 (\2) {/' $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment