Recursively Expand Tabs to Spaces
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 /path/to/script/rexp.sh.
cd /path/too/foo/
/path/to/script/rexp.sh *.luaWritten by Seppi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#