aaa.txt
"/home/ccc/a.c", line 180: Warning: #warning "restore this ASSERT this after ais fixed on df".
"/home/ccc/b.c", line 255: Warning: #warning "restore this ASSERT this after afis fixed on afd".
2 Warning(s) detected.
bbb.txt
"/home/ccc/a.c", line 181: warning: #warning "restore this ASSERT this after ais fixed on df".
"/home/ccc/b.c", line 182: warning: #warning "restore this ASSERT this after afis fixed on afd".
2 Warning(s) detected.
我想用shell查关键字==> : warning: 或 : Warning: 找到有这两个关键字的这一行就写到另外一个文件compile_warning中,请问如何实现,谢谢
结果compile_warning.txt要如下:
"/home/ccc/a.c", line 180: Warning: #warning "restore this ASSERT this after ais fixed on df".
"/home/ccc/b.c", line 255: Warning: #warning "restore this ASSERT this after afis fixed on afd".
"/home/ccc/a.c", line 181: warning: #warning "restore this ASSERT this after ais fixed on df".
"/home/ccc/b.c", line 182: warning: #warning "restore this ASSERT this after afis fixed on afd".
|
grep -i "warning:" aaa.txt > bbb.txt
|
好快啊 雨兄!
|
哪里哪里
刚好路过
|
这样会区分大小写 只有Warning:的行 讲不会被找出来
为了保险 我推荐你加上-i选项
|
+1