Having trouble finding a word in multiple files

Peter Flynn peter at silmaril.ie
Sun Jun 14 08:19:04 UTC 2020


On 14/06/2020 08:53, Pat Brown wrote:
> I've tried a variety of grep commands but I can't find the specific 
> word I'm searching for that is in a file or files somewhere in my 
> Dropbox folder. The word I'm trying to find is Blowback. Can someone 
> please help me with the correct command?

I don't use Dropbox, so I'm not familiar with what "a Dropbox folder" 
is. Is it a real directory on your disk containing actual files, or is 
it some kind of soft link to a network location at dropbox.com, and the 
files are actually stored out there on their machine, not yours?

If they are files and directories physically stored on your disk, then 
the find and grep utilities will work like this:

$ find ~/Dropbox -type f -name '*' -exec grep -il blowback {} \;

Replace ~/Dropbox with whatever your Dropbox directory is called.
This finds all normal files (type f) with any name (name '*') and then 
runs grep on each one in turn and looks for caseless 'blowback' and just 
gives the filename of successful searches, not the entire line of text.

grep can read some non-text file formats but I don't know what it does 
with binaries like .docx

If the Dropbox folder is a link to files elsewhere, I don't know what 
will happen — I'd be very interested to learn :-)

Peter




More information about the ubuntu-users mailing list