Currently I can grep (in command line) the gzip files I receive using the command zgrep -a something logs.tar.gz it outputs every line inside the logs.tar.gz but without the file where it was found, so is 80% useful.

Then I turned to emacs but when I do the equivalent command zrgrep I get only the Binary file ./logs.tar.gz matches, when I click it opens the tar.gz file, but I don't see the matches. I tried to visualise it by installing ascii with el-get without success and read over the different greps. Unfortunately I didn't find any clue on how to grep the open gz file in the buffer, it always refers to a physical dir. So currently I need to uncompress it and do the regular grep (that works well)

Is it possible to have the possibility to pass the command -a to get it in ascii text?


Is there any possibility to run a grep (or equivalent command) on the buffer I have the gz file open?

  • 1
    See some useful answers here: stackoverflow.com/questions/2407111/… unfortunately, zgrep cannot do what you want. – wvxvw Jan 13 '17 at 14:19
  • @wvxvw thanks for the info, I also landed in that question before. Find it a pity that you can't run the grep against the buffer. I guess is not that trivial to use the buffer as a fs to grep over the files that are there. It would be helpful as you face no IO constrains. – user12383 Jan 13 '17 at 14:23
  • Well, you'd need to extend tar-mode with an ability to, say, mark entries and then you could run zgrep -Hna plus a wc -l on each of the archived files to figure out what offset relates to what file... but this sound like quite a bit of coding... – wvxvw Jan 13 '17 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy