indentations
Batch Convert 4-Space Indentations to 2-Space
While adding a linter to an old project, I wrote the following bash script to convert 4-space indentations to 2-space indentations. This example recursively looks for *.js files starting at the script’s location. Of course, it can be used for any type of file though by simply changing the extension.
![](https://secure.gravatar.com/avatar/4a284f48ea909d7b59ef1a93da122743?s=110&d=https%3A%2F%2Fblog.alexseifert.com%2Fwp-content%2Fuploads%2F2024%2F03%2F32aeadc0-74b6-4ff7-8347-41ce3187b321.jpg&r=g)
Alex is a developer, a drummer and an amateur historian. He enjoys being on the stage in front of a large crowd, but also sitting in a room alone, programming something or writing about history.
Visit my portfolio →