Kategorie
Bash

Find file name which contain a centrain string using grep and find

If you only want to find the file names that have a certain string without showing the matching line:

root@server:/# find . -type f -print0 | xargs -0 grep -l "string"

and you want to exclude file name that containing certain string:

root@server:/# find . -type f -print0 | xargs -0 grep -l "string" | grep -v "string2"

Finding file name that have certain name:

root@server:/# find . -type f -name "some_name*.*"

 

3 odpowiedzi na “Find file name which contain a centrain string using grep and find”

very interesting details you have remarked, regards for putting up.
I like this weblog its a master peace ! .
Lovely just what I was looking for.
wohh just what I was looking for, thanks for posting .

I’m trying to find a way to scan my entire Linux system for all files containing a specific string of text. Just to clarify, I’m looking for text within the file, not in the file name.

Możliwość komentowania jest wyłączona.