Edit detail for tabs2spaces revision 1 of 1

1
Editor: rgouveia
Time: 2010/04/17 17:01:39 GMT+2
Note:

changed:
-
<b> substitute tabs with 4 spaces starting on $dir and its subdirs on files ending with $ext</b>
<pre>
#!/bin/sh

# always use full paths
dir=/home/user/code
ext=py
tmpFile="/tmp/ftabs2spaces"

find $dir -name \*.$ext > $tmpFile

while read file;
do
 fileBak=$file.bak
 echo $file "->" $fileBak
 mv $file $file.bak
 cat $fileBak | sed -e 's/[\t]/    /g' > $file
done < $tmpFile
</pre>

substitute tabs with 4 spaces starting on $dir and its subdirs on files ending with $ext
#!/bin/sh

# always use full paths
dir=/home/user/code
ext=py
tmpFile="/tmp/ftabs2spaces"

find $dir -name \*.$ext > $tmpFile

while read file;
do
 fileBak=$file.bak
 echo $file "->" $fileBak
 mv $file $file.bak
 cat $fileBak | sed -e 's/[\t]/    /g' > $file
done < $tmpFile