Skip to content

Instantly share code, notes, and snippets.

@lintianzhi
Created November 29, 2012 14:10
Show Gist options
  • Save lintianzhi/4169323 to your computer and use it in GitHub Desktop.
Save lintianzhi/4169323 to your computer and use it in GitHub Desktop.
some pipe use, find sed grep
# 目录下面所有文件的tab换成4个space 注意 '\t' 不是 "\t"
grep -lr '\t' . | xargs sed -i "s/\t/ /g"
# 查找 .py 结尾的文件 | 如果里面含有tab | 把文件的tab换成4个space # 其实第二个是多余的
find . -name "*.py" | xargs grep -lr '\t' | xargs sed -i "s/\t/ /g"
# <ctrl-v><tab> 可以打出一个tab
#就像 <ctrl-v><ctrl-m> 可以打出一个^M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment