简体   繁体   English

从文件夹中的所有文档中打印特定行

[英]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.

相关问题 如何从文件夹中的所有文件中删除带有特定字符串的行 - How to remove from all files in folder the lines with specific string 从文件夹中的所有文件中提取 200 行 - Extracting 200 lines from all the files in a folder 从匹配特定字段的文件中打印行 - Printing lines from a file where a specific field is matched 从文件中的特定字段不以某些内容开头的行中打印 - Printing lines from a file where a specific field does not start with something 如何从所有文件中删除特定行? - How to remove specific lines from all files? 如何在执行cgi时使apache跳过特定的stdout行或停止从打印到stdout的共享库 - How to make apache skip specific stdout lines when executing cgi or stop shared library from printing to stdout 从文件中删除所有行,以特定字符串开头和结尾 - Remove all lines from a file, starting and ending with a specific string 当特定单词至少出现在特定数量的行上时,从文件夹中查找文件 - Find files from a folder when a specific word appears on at least a specific number of lines 将文件夹中的所有.tgz 文件解压缩到特定文件夹 - unzipping all .tgz files in folder to a specific folder 从特定文件夹中的所有tar文件中提取特定文件类型 - Extracting specific file types from all tar files from specific folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM