简体   繁体   中英

Printing specific lines from all documents in a folder

I want to print all the lines that contains "testing.$" from all folder's files.

I am trying the following command, but I am getting a error. What am I missing?

find ./* -type f -exec grep -l testing.$ {} \\ | grep -n ^ | grep ^Linha_do_Arquivo: | cut -d: -f2;

find: missing argument: '-exec'

You don't need find for this.
With grep only:

grep -rh "testing.$" .

-h hides the filename in the output. Omit it if you want to output it as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM