You can use expand to replace tabs with spaces. For example, if your editor has tab set as 4 spaces then use: expand -4 MyFile.java > temp VERIFY WITH AN EDITOR THAT IT DID THE RIGHT THING IN temp THEN mv temp MyFile.java The default is 8 spaces so expand MyFile.java > temp will replace tabs with 8 spaces.