Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mork

macrumors 6502a
Original poster
Jan 9, 2009
538
29
Looking at the search utilities available on the Mac (Houdaspot and the like), all of them seem to rely on the Spotlight index. The exception, EasyFind, doesn't do what I want, either.

Simply put, all I need to do is search a directory that has 50 or so compressed backup (.gz) files for matching text in the text files within them.

From all my searching, there is not a single utility on the mac that will do this.

What am I missing? Don't mac developers have the same needs?

File Locator Pro on Windows will do this search, but I'd rather stay on the Mac, if possible.

File search tools seem to be a weak link on the mac platform.

Thanks in advance for suggestions. :)

- m
 

Mork

macrumors 6502a
Original poster
Jan 9, 2009
538
29
Did not know about this program.

In any case, I can't get it to work. I sent it to my temp folder where I have lots of text files that have no extension. When I try to index that folder I select the "..." and it only shows one of the many files there. But, Ok, all these text files have no extension so I figure it's OK that it's only showing one of them.

Yet, when I enter a search term at the top (after indexing), it doesn't find anything.
I made sure the term was in one of the text files.
(Not even trying a .gz file yet).

Seems straightforward, but what could I be doing wrong?

Thanks.
 

Zazoh

macrumors 65832
Jan 4, 2009
1,504
1,094
San Antonio, Texas
zgrep from the terminal, I've never tried it but it is supposed to work on compressed files.

http://linux.about.com/od/linux101/fl/zgrep-Linux-Command-Unix-Command.htm

I just tried it ...

I had an archive called Archive.zip I knew there was ThanksGiving in the text files.

zgrep "ThanksGiving" archive.zip

I got that the binary files "Matches"

I then searched for a word I knew wasn't there, and nothing came back, so it looks like it at least works to find zip files that contain your pattern.
 
Last edited:
  • Like
Reactions: organicCPU

Mork

macrumors 6502a
Original poster
Jan 9, 2009
538
29
zgrep from the terminal, I've never tried it but it is supposed to work on compressed files.

http://linux.about.com/od/linux101/fl/zgrep-Linux-Command-Unix-Command.htm

I just tried it ...

I had an archive called Archive.zip I knew there was ThanksGiving in the text files.

zgrep "ThanksGiving" archive.zip

I got that the binary files "Matches"

I then searched for a word I knew wasn't there, and nothing came back, so it looks like it at least works to find zip files that contain your pattern.

Cool,

Can you do something like zgrep "SearchTerm" .\*.gz

To search all the .gz files in a directory?
 

Zazoh

macrumors 65832
Jan 4, 2009
1,504
1,094
San Antonio, Texas
Cool,

Can you do something like zgrep "SearchTerm" .\*.gz

To search all the .gz files in a directory?

Yup you got it. Or you could search recursively into sub folders.

grep -r --include=*.gz "term" ./
  • -r: recursively
  • --include: all *.gz files
  • ./ Start in current directory
 
  • Like
Reactions: organicCPU

organicCPU

macrumors 6502a
Aug 8, 2016
827
287
Seems straightforward, but what could I be doing wrong?
It's most likely that you didn't set the DocFetcher preferences to your needs.
If you right click on a single search scope and select -> rebuild index -> a window is popping up.
There you can set your search patterns like this:
These are not a bad idea to exclude as filename
Code:
__MACOSX
\._.*\..*
\.DS_Store
\._.*

If you want to index files without an extension, here is what the DocFetcher´s FAQ is telling about this:
How can I index files that don't have a file extension?
To index files without file extension (i.e. without the dot in the filename), add the following rule in the pattern table on the indexing dialog:

Pattern (regex): [^\.]*
Match Against: Filename
Action: Detect mime type (slower)
This rule matches all files whose filenames do not contain a dot, and it will make DocFetcher recognize the matched files as plain text files.

Then above the input field for search patterns you define the file extensions for archives. I guess it's a good idea to add zip, gz ... there.
With those adjustments made and having reindexed, chances are high you'll find what you want.

@Zazoh besides zgrep also zegrep for more complex search patterns and zfgrep for faster results without regular expressions should work.
 

Mork

macrumors 6502a
Original poster
Jan 9, 2009
538
29
It's most likely that you didn't set the DocFetcher preferences to your needs.
If you right click on a single search scope and select -> rebuild index -> a window is popping up.
There you can set your search patterns like this:
These are not a bad idea to exclude as filename
Code:
__MACOSX
\._.*\..*
\.DS_Store
\._.*

If you want to index files without an extension, here is what the DocFetcher´s FAQ is telling about this:


Then above the input field for search patterns you define the file extensions for archives. I guess it's a good idea to add zip, gz ... there.
With those adjustments made and having reindexed, chances are high you'll find what you want.

@Zazoh besides zgrep also zegrep for more complex search patterns and zfgrep for faster results without regular expressions should work.

Awesome!

Thanks very much! :)
[doublepost=1479985487][/doublepost]
Yup you got it. Or you could search recursively into sub folders.

grep -r --include=*.gz "term" ./
  • -r: recursively
  • --include: all *.gz files
  • ./ Start in current directory

Cool, thanks.

But, what actaully worked for me (thanks to your reply) was:

zgrep -r "SearchTerm" ./

(this searches both regular text files an .gz files).

Excellent!!!!

Thanks again!

- m
 
  • Like
Reactions: Zazoh
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.