Last active
August 29, 2015 14:11
-
-
Save bluemanos/af3e36a3343bf3a3260f to your computer and use it in GitHub Desktop.
Convert tabs to spaces in PHP/HTML/CSS/TXT files
This file contains hidden or 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/sh | |
# script to convert tabs to spaces in PHP files | |
# usage: ./expand /path/to/project/directory | |
echo $(date) | |
path=${1:-.} | |
for f in $(find "$path" -type f -name \*.php -o -name \*.html -o -name \*.css -o -name \*.txt -o -name \*.js) | |
do | |
oryginal_file=`cat "$f"` | |
expanded_file=`expand -i -t4 "$f"` | |
if [ "$oryginal_file" != "$expanded_file" ]; then | |
echo "$expanded_file" > "$f" | |
fi | |
done | |
echo $(date) |
This file contains hidden or 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/sh | |
# script to convert spaces to tabs in PHP files | |
# usage: ./unexpand /path/to/project/directory | |
echo $(date) | |
path=${1:-.} | |
for f in $(find "$path" -type f -name \*.php -o -name \*.html -o -name \*.css -o -name \*.txt -o -name \*.js) | |
do | |
oryginal_file=`cat "$f"` | |
unexpanded_file=`unexpand -t4 "$f"` | |
if [ "$oryginal_file" != "$unexpanded_file" ]; then | |
echo "$unexpanded_file" > "$f" | |
fi | |
done | |
echo $(date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment