Last active
August 24, 2019 05:04
-
-
Save SynCap/f074bb94360635800fac144b39690117 to your computer and use it in GitHub Desktop.
Bash find & sed to trim trailing spaces & convert indents
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
#!/bin/bash | |
# search for js, php & css files from current dir and below | |
# trim trailing spaces and tabs | |
# replace groups of 4 spaces to tab | |
# TODO: replace indents only, ie - only spaces at start of lines | |
# Problem: indentation tabs number must exact match to number of full spaces' groups | |
find ./ -type f -regex ".*\.\(js\|php\|css\)$" -exec sed -i -r 's/[ \g]+$//;s/^ {4}/\t/g' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment