S
S
sasvak2017-08-03 01:24:48
linux
sasvak, 2017-08-03 01:24:48

How to find the desired file via linux terminal knowing the file contains a word?

You need to find the file.
There are many folders. One of them contains a file. The file contains a word.
There are many files, there are tar archives, there are gz archives. There is a nesting doll - one in the other - an archive in an archive.
How to find the desired file via linux terminal knowing the file contains a word?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Zhurkin, 2017-08-03
@icCE

I'm afraid it will be necessary to write a script that will unpack the archives. Alas, but without it, not how.
Everything else is solved by grep, egrep, awk or find.
grep -lir 'text' /home/%username%/doc

V
Victor Taran, 2017-11-18
@shambler81

for thought
find . -type f -exec grep -l "content" {} \;
-l - Displays the name of the file in which the content was found.
accordingly, you will need to unpack files on the fly and run find inside
Well, yes, most likely you will need to change something
Find all php.ini files and replace the directive in them

find . -name 'php.ini' -exec sed -i 's/log_errors = Off/log_errors = On/g' "{}" \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question