标签:add name error mat div ade sed ack min
一、Find
1)批量删除文件
find . -name "*.h~" -exec rm ‘{}‘ \;
2)定位文件某一行
find / -name "demo.conf" | egrep -v "default" | xargs grep -n "demo" | head -1 | cut -d "/" -f 4
3)查找一级目录
find / -type d -maxdepth 1 -mindepth 1 | egrep -v "(default|global|htdoc)
4)替换文件某行
find / -name "demo.conf" | egrep -v "default" | xargs sed -i ‘i/demo/demo:test/g‘
5)在文件某行后插入内容
find / -name "demo.conf" | xargs sed -i ‘‘$(find / -name "demo.conf" | egrep -v "default" | xargs grep -n "demo" | head -1 | cut -d ":" -f 4)‘ademo\ndemo‘
二、Grep
grep get_default_error_string * -rFn --binary-files=without-match
三、正则表达式
标签:add name error mat div ade sed ack min
原文地址:http://www.cnblogs.com/274914765qq/p/6055569.html