-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell text operator
25 lines (18 loc) · 1.56 KB
/
shell text operator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
过滤 map.ini 中的section [] , 直接创建新的文件
grep "[\[a-zA-Z1-9\]]" superl2map.ini | tr -d '[]' | tr 'A-Z' 'a-z' | xargs -I {} cp map_bigloop.json map_{}.json
通过查找,文件后直接修改文件
find . -name BUILD -print0 | xargs -I {} -0 sed -i 's/cc_library/dw_cc_library/g' {}
find . -name BUILD -print0 | xargs -I {} -0 sed -i 's/\@rules_cc\/\//\/\/bazel\/build_rules\//g' {}
通过过滤指定字段找到文件, 直接修改文件
grep '\-soname' . -r | grep -v cmake | cut -d : -f1 | sort | uniq | xargs -I {} sed -i 's/cc_library/dw_cc_library/g' {}
grep '\-soname' . -r | grep -v cmake | cut -d : -f1 | sort | uniq | xargs -I {} sed -i 's/\@rules_cc\/\//\/\/bazel\/build_rules\//g' {}
grep "dwframework/node/Node.hpp" . -rn | cut -d : -f1 | sort | xargs -I {} sed -i 's/dwframework\/node\/Node.hpp/dwframework\/base\/node\/Node.hpp/g' {}
通过匹配夫批量修改
grep "dwframework/" . -rn | grep -v "nodes" | cut -d : -f1 | sort | uniq | xargs -I {} sed -i 's/dwframework\//dwframework\/base\//g' {}
grep "/base/base/" . -rn | cut -d : -f1 | sort | xargs -I {} sed -i 's/\/base\/base\//\/base\//g' {}
nodes folder need revert:
grep "dwframework/base/nodes/" . -rn | cut -d : -f1 | sort | xargs -I {} sed -i 's/dwframework\/base\/nodes\//dwframework\/nodes\//g' {}
node folder:
grep "dwframework/Types.hpp" . -rn | cut -d : -f1 | sort | xargs -I {} sed -i 's/dwframework\/Types.hpp/dwframework\/base\/Types.hpp/g' {}
通过过滤指定文件,查找内容
find . -name *.hpp -print0 | xargs -I {} -0 grep "CHECK_DW_ERROR_MSG" -n --with-filename {}