Nп/п : 94 из 100
 От   : Janis Papanagnou                    2:5075/128        26 сен 23 16:54:19
 К    : Marco Moock                                           26 сен 23 17:55:03
 Тема : Re: Get a list of files that contain a string
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@dont-email.me> db2a8fca
@REPLY: 4@dont-email.me> 4adde48d
@REPLYADDR Janis Papanagnou
<janis_papanagnou+ng@hotmail.com>
@REPLYTO 2:5075/128 Janis Papanagnou
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@dont-email.me>
@RFC-References: 4@dont-email.me>
@TZUTC: 0200
@PID: Mozilla/5.0 (X11; Linux x86_64; rv:45.0)
Gecko/20100101 Thunderbird/45.8.0
@TID: FIDOGATE-5.12-ge4e8b94
On 26.09.2023 15:02, Marco Moock wrote:
> Hello!

> What is the best way to get a list of files that contain a specific
> string without printing the content?

> I can use find to select all files in a directory including subdirs and
> I can use grep to filter it, but it prints the content.

> Is there a better solution for that?

If you don`t need to "find" the files it`s just

  grep -lF specific-string  ...list-of-files-and-or-file-patterns...

or if you have to find the files

  find ...file-properties... | xargs grep -lF specific-string

It it`s not a "specific string" but a regular expression pattern that
you want to match in the files then omit grep`s F option, use just -l.

If filenames contain blanks and whatnot, add option -print0 to find
and -0 (this is a `dash zero`) to xargs.

Alternatively you may also use find`s -exec option instead of xargs.

Janis

--- Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх