Skip to content

Instantly share code, notes, and snippets.

@kiltec
Created March 10, 2011 08:59
Show Gist options
  • Save kiltec/863789 to your computer and use it in GitHub Desktop.
Save kiltec/863789 to your computer and use it in GitHub Desktop.
Fix else-statements in C like languages
# This command converts:
# }
# else {
# echo $bleh;
# }
#
# to:
# } else {
# echo $bleh;
# }
#
# Don't remove the line break after the "{N" otherwise it won't work.
find . -name "*.php" -exec sed '/}$/ {N
s/\}\n[\t]*else/\} else/ }' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment