Utility that will search Zips (and .gz) files?

Discussion in 'Mac Basics and Help' started by Mork, Nov 23, 2016.

  1. Mork macrumors 6502

    Joined:
    Jan 9, 2009
    #1
    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
     
  2. organicCPU macrumors 6502

    organicCPU

    Joined:
    Aug 8, 2016
    #2
    What about DocFetcher? I mainly use it to search for text in html files within zip-archives without unzipping them.
     
  3. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #3
    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.
     
  4. Zazoh, Nov 23, 2016
    Last edited: Nov 23, 2016

    Zazoh macrumors 6502a

    Zazoh

    Joined:
    Jan 4, 2009
    Location:
    San Antonio, Texas
    #4
    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.
     
  5. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #5
    Cool,

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

    To search all the .gz files in a directory?
     
  6. Zazoh macrumors 6502a

    Zazoh

    Joined:
    Jan 4, 2009
    Location:
    San Antonio, Texas
    #6
    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
     
  7. organicCPU macrumors 6502

    organicCPU

    Joined:
    Aug 8, 2016
    #7
    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.
     
  8. Mork thread starter macrumors 6502

    Joined:
    Jan 9, 2009
    #8
    Awesome!

    Thanks very much! :)
    --- Post Merged, Nov 24, 2016 ---
    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
     

Share This Page