Maybe OT - Grepping the locate command
donn
donn.ingle at gmail.com
Wed Mar 3 10:39:33 GMT 2010
Hi, I shall make this on-topic by saying something flameworthy like
"stupid UBUNTU locate command!" :) Anyhoo, here's the thing that's
puzzling me:
I would like to search through the *contents* of the files returned by
locate. So far I have not had much luck.
locate *.ods | grep blah
(No good because it greps the filenames, not their contents)
locate *.ods | strings | grep blah
(I thought this one would work, but strings is only repeating the
filenames sent by locate)
Oddly, ls suffers a similar fate:
ls | cat
(I expected a long cat of all the files listed. I got the same as ls on
its own. I am sure I am missing something basic here.)
So, at this point I headed for wilder territory ending up with a for f
in `locate ... kind of affair. Horrible and has issues with long filenames.
Eventually I gave-up and used find:
find . -name "*.ods" -exec strings {} \;| grep BLAH
Only to discover that ods files are zipped! Argh.
That aside; I like the locate command because it's a nice wide net that
does not need a starting path -- anyone have some idea how its results
could be turned into actual files and opened/catted/grepped etc?
\d
--
Fonty Python and Things! -- http://otherwise.relics.co.za/wiki/Software
More information about the sounder
mailing list