Converting tabs to spaces in many files
Try the following:
find ./ -type f -exec sed -i 's/\t/ /g' {} \;
If you want four spaces, try:
find ./ -type f -exec sed -i 's/\t/ /g' {} \;
There are lots of ways to do this. There are also lots of ways to shoot yourself in the foot while doing this if you're not careful or if you're new to Linux as you appear to be. Assuming that you can create a list of files that you want to convert, either by using something like find
or manually with an editor, just pipe that list into the following.
while read file
do
expand "$file" > /tmp/expandtmp
mv /tmp/expandtmp "$file"
done
One way you can shoot yourself in the foot with that is to make a typo so that you wind up mv'ing an empty file to all of the file names you specify, thereby deleting the contents of all your files. So be careful and test whatever you do first on a small set of files that you have backed up.
find . -type f -iname "*.js" -print0 | xargs -0 -I foo tab2space foo foo
-I foo
creates a template variable foo for each input line, so you can refer to the input more than once.
-print0
and -0
tell both commands to use \0 as a line separator instead of SPACE, so this command works for paths with spaces.