Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Batch Convert 4-Space Indentations to 2-Space
expand_func () {
OLD_LENGTH=4 # old indentation length
NEW_LENGTH=2 # new indentation length
unexpand -t $OLD_LENGTH "$1" | expand -t $NEW_LENGTH > "$1.tmp"
mv "$1.tmp" "$1"
export -f expand_func
find ./ -name \*.js -exec bash -c 'expand_func {}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment