Basically searching all files in a directory and locating those that contain a certain word within them. For example, I want to know what files contain the word 'apple', if there is just print the filenames that contain 'apple' somewhere in the text. The only thing I really need to know is how to put a command such as find into a conditional statement, or if there are better alternatives. Thanks.
flipjoebanana
0
Junior Poster in Training
Recommended Answers
Jump to PostYou could just use
grep
without the find. Usegrep -l -r -i
Jump to PostYou could just use
grep
without the find. Usegrep -l -r -i
That's quite true, there are many ways to skin a cat!
Personally, though, I usually use
find
in cases like this, because of its greater flexibility in selecting files - such as by date accessed, …
All 6 Replies
Simon Tite
15
Light Poster
sknake
1,622
Senior Poster
Featured Poster
Simon Tite
15
Light Poster
sknake
commented:
:)
+6
flipjoebanana
0
Junior Poster in Training
nezachem
616
Practically a Posting Shark
thekashyap
193
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.