我如何转换选项卡,以空格目录中的所有文件? [英] How can I convert tabs to spaces in every file of a directory?
本文介绍了我如何转换选项卡,以空格目录中的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么可以转换选项卡,以空格目录中的所有文件(可能递归)?
此外,有没有每个选项卡中设置的空格数的方法吗?
解决方案
警告:这会损坏二进制文件(
SVN
,的.git
。 ..)!
块引用>
找到。型的F -exec SED -i.orig的/ \\吨/年/ G'{} +
原始文件保存为
[文件名] .orig这样
。缺点:
- 将在文件中到处更换标签。
- 如果你碰巧有一个5GB的SQL转储该目录中需要很长的时间。
How can I convert tabs to spaces in every file of a directory (possibly recursively)?
Also, is there a way of setting the number of spaces per tab?
解决方案Warning: This may corrupt binary files (
svn
,.git
, ...)!
find . -type f -exec sed -i.orig 's/\t/ /g' {} +
The original file is saved as
[filename].orig
.Downsides:
- Will replace tabs everywhere in a file.
- Will take a long time if you happen to have a 5GB SQL dump in this directory.
这篇关于我如何转换选项卡,以空格目录中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文