本记录 便于于 同样需求时 快速操作

1
2
3
4
5
6
7
8
9
10
11
12
13
14

原字符串
printf("ERROR: file:%s line:%u\n", __FILE__, __LINE__);

改后字符串
printf("ERROR in file:%s +%u\n", __FILE__, __LINE__);

注意这里有待转译的符合.


#验证
echo `grep -inrl "printf(\"ERROR: file:%s line:%u\\\\\\\n\", __FILE__, __LINE__);"`

sed -i 's/printf("ERROR: file:%s line:%u\\n", __FILE__, __LINE__);/printf("ERROR in file:%s +%u\\n", __FILE__, __LINE__);/g' echo `grep -inrl "printf(\"ERROR: file:%s line:%u\\\\\\\n\", __FILE__, __LINE__);"`