[英]Printing specific lines from all documents in a folder
I want to print all the lines that contains "testing.$" from all folder's files. 我想从所有文件夹的文件中打印所有包含“ testing。$”的行。
I am trying the following command, but I am getting a error. 我正在尝试以下命令,但出现错误。 What am I missing?
我想念什么?
find ./* -type f -exec grep -l testing.$ {} \\ |
查找./* -type f -exec grep -l测试。 grep -n ^ |
grep -n ^ | grep ^Linha_do_Arquivo: |
grep ^ Linha_do_Arquivo:| cut -d: -f2;
切-d:-f2;
find: missing argument: '-exec'
查找:缺少参数:'-exec'
You don't need find
for this. 你不需要
find
了这一点。
With grep
only: 仅使用
grep
:
grep -rh "testing.$" .
-h
hides the filename in the output. -h
在输出中隐藏文件名。 Omit it if you want to output it as well. 如果也要输出,则忽略它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.