PDA

View Full Version : Doc Search Tool



scottjsn
29-Aug-2012, 16:24
Use SLED 11 R2 (kernel 3.0.13). Try to locate a file containing certain character string.

For instance, a document named Test.doc contains the words "Find Me". My reasonable guess is this file may locate at /home/tester directory, but not sure. So I went to Tolls --> Find File. In the popup window, I types Find Me in the Contain Text in the Containing Text field. More often than not, I could not find the file Test.doc which indeed contains the words "Find Me" and is located at /home/tester.

Is there a third party search utility which could be more efficient and I can download somewhere?




(Back in Windows, there was a good tool named Agent Ransack. I just hope there is one for SUSE).

malcolmlewis
29-Aug-2012, 16:49
Use SLED 11 R2 (kernel 3.0.13). Try to locate a file containing certain
character string.

For instance, a document named Test.doc contains the words "Find Me".
My reasonable guess is this file may locate at /home/tester directory,
but not sure. So I went to Tolls --> Find File. In the popup window, I
types Find Me in the Contain Text in the Containing Text field. More
often than not, I could not find the file Test.doc which indeed contains
the words "Find Me" and is located at /home/tester.

Is there a third party search utility which could be more efficient and
I can download somewhere?




(Back in Windows, there was a good tool named Agent Ransack. I just
hope there is one for SUSE).



Hi
That depends if beagle (never used it) is running.... I always use the
CLI and fgrep....


fgrep -r "Find\ Me" .
or
fgrep -r "Find\ Me" /home/*



--
Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 3.0.38-0.5-default
up 1 day 13:22, 2 users, load average: 0.29, 0.30, 0.45
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

mikewillis
29-Aug-2012, 20:10
fgrep -r "Find\ Me" .
or
fgrep -r "Find\ Me" /home/*



Curious, that doesn't work for me.

me@mine:/tmp> fgrep "Find\ Me" foo.txt
me@mine:/tmp> fgrep "Find Me" foo.txt
Find Me
me@mine:/tmp>
grep works with the backslash though

me@mine:/tmp> grep "Find Me" foo.txt
Find Me
me@mine:/tmp> grep "Find\ Me" foo.txt
Find Me
me@mine:/tmp> grep Find\ Me foo.txt
Find Me

I lack the energy to work out why right now.

scottjsn - I can't work out what tool it is you're using. Where exactly is this 'Tools' you're referring to? I had a look in Application Browser but the closest I could find in the Tools section is 'Search for Files...' which doesn't look like what you describe.

I find it odd that you say "more often than not" because that implies the search was sometimes successful.

One problem might be that Test.doc is presumably a Microsoft Word file and hence binary rather than plain text. If the tool you're using only works with plain text files it might not be able to find the string you're searching for in a Microsoft Word file.

grep or it's variants are really the best way to search through lots of files. You can chain greps together. E.g. to find files in the working directory that contain both the words foo or Foo or FoO or FOO or any other case variant and also the word bar or any case variant

$ grep -i foo * | grep -i baa
or to just search files which start with the letter A

$ grep -i foo A* | grep -i baa
As ever, you can do fancy things using regular expressions if you feel so inclined.