a.cpp動態時的grep
int main()
{
bool b;
bool c = true;
bool d;
bool e ;
bool f ;
int x = 3;
std::cout << "x is " << x << std::endl;
return 0;
}
grepping對於具有布爾變量,而無需定義C文件的輸出替換節目的內容。
grep -rn --include \*.cpp --include \*.c bool | grep -v 'svn\|virtual\|::' | grep 'bool\([ ]\+[A-Z0-9a-z_]*[ ]*\);'
輸出
a.cpp:3: bool b;
a.cpp:6: bool d;
a.cpp:7: bool e ;
a.cpp:8: bool f ;
現在我想使用命令這些行修改,以
bool b=false;
bool d=false;
bool e=false;
bool f=false;
。
有人可以提出一種方法。由於
嗨,它正在工作,但不是完全... bool b = false; bool c = true; bool d = false; bool e; bool f; e,f不會更改它們的值 – naren
我忘記了'\(\)'圍繞'-name -o -name',* .c文件未處理更新 –
@naren在您的評論之後,分號後是否有空格';'和在新行之前 –