Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OS X: replace tabs with spaces in all files using expand
find . -name "*.php" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done
@schrockwell

This comment has been minimized.

Copy link

@schrockwell schrockwell commented Jul 20, 2016

Thanks! For anyone reading this, replace the option -t 4 with the number of spaces you wish to replace each tab with.

@phackwer

This comment has been minimized.

Copy link

@phackwer phackwer commented Nov 5, 2017

Thanks. I was going crazy trying to use linux commands on mac os. Even freebsd commands are not 100% in mac. This saved me a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment