Using the common
find and the lesser known,
expand, one can easily replace tabs with spaces. In this script, the current directory will be parsed, and all tabs will be replaced with two spaces.
#!/bin/sh # Recursively expand find . -name $1 | while read line do expand --tabs=2 $line > $line.tmp mv $line.tmp $line
Here is an example of parsing all
*.lua files recursively in
/path/to/foo/. The script is located at
cd /path/too/foo/ /path/to/script/rexp.sh *.lua