0

I have a big GZ file ("Turtle RDF" file) (about ~15Gb compressed, ~88 uncompressed), and I need to know if there is a solution with PHP to find the lines whoes contains specific string.

I found this solution by zerkms but my dev environment is Windows. I tested gzopen, gzgets, gzread but I cannot find how search in the file and keep some performances at the same time.

Thanks for your help!

Community
  • 1
  • 1
DrSAS
  • 396
  • 7
  • 16
  • 1
    `zcat file.gz | grep 'whatever'`? – Marc B Jul 16 '13 at 15:02
  • @MarcB Hi! Like i said, i don't think I can use grep. Because of my dev environment (Windows). I'm wrong? – DrSAS Jul 16 '13 at 15:06
  • @MarB or just `zgrep 'whatever' file.gz` – dennis Jul 16 '13 at 15:10
  • there's `find` for windows, if necessary. grepping 88gigs is still going to be slow no matter what you do, especially if you have to decompress the file each time. – Marc B Jul 16 '13 at 15:14
  • @MarcB Can I do that without decompression? – DrSAS Jul 16 '13 at 15:18
  • 1
    no. you cannot search for a string WITHOUT decompressing the text first. `gzip('foo')` v.s. `gzip('barfoobaz')` will produce two completely different compressed strings, and the compression equvialent of `foo` will not be the same as the `foo` inside `barfoobaz`. – Marc B Jul 16 '13 at 15:20

0 Answers0