Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loicginoux/74785620b5aaaf88094000e58a223405 to your computer and use it in GitHub Desktop.
Save loicginoux/74785620b5aaaf88094000e58a223405 to your computer and use it in GitHub Desktop.
find all html files and change indentation from 4 spaces by 2 spaces
# find all html files in a directory and update indentation
find . -iregex '.*/.*\.html' -exec perl -pi -e 's{^((?: {4})*)}{" " x (2*length($1)/4)}e' {} \;
# update ndentation for one file
perl -pi -e 's{^((?: {4})*)}{" " x (2*length($1)/4)}e' yourfile.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment