There I said it !

  • @[email protected]
    link
    fedilink
    44 hours ago

    How do you propose zcat tell the difference between an uncompressed file and a corrupted compressed file? Or are you saying if it doesn’t recognize it as compressed, just dump the source file regardless? Because that could be annoying.

    • @[email protected]OP
      link
      fedilink
      13 hours ago

      Even a corrupt compressed files has a very different structure relative to plain text. “file” already has the code to detect exactly which.

      Still, failing on corrupted compression instead of failing on plaintext would be an improvement.

  • elmicha
    link
    fedilink
    2116 hours ago

    I agree. zgrep also works for uncompressed files, so we could use e.g. zgrep ^ instead of zcat.

      • @[email protected]
        link
        fedilink
        45 hours ago

        Won’t this cause cat to iterate through all files in the cwd once zcat encounters an issue, instead of just the specific file?

        • @[email protected]
          link
          fedilink
          12 hours ago

          Yeah, i was tired and had $file there first, then saw that you wanted to cat all in directory. Still tired, but i think this works now.

    • @[email protected]OP
      link
      fedilink
      2
      edit-2
      16 hours ago

      Thanks !

      But still we shouldn’t have to resort to this !

      Also, can’t get the output through pipe

      for i in $(ls); do zcat $i || cat $i; done | grep mysearchterm

      this appears to work

      find . -type f -print0 | xargs -0 -I{} sh -c 'zcat "{}" 2>/dev/null || cat "{}"' | grep "mysearchterm"

      Still, that was a speed bump that I guess everyone dealing with mass compressed log files has to figure out on the fly because zcat can’t read uncompressed files ! argg !!!

      for i in $(ls); do zcat $i 2>/dev/null || cat $i; done | grep mysearchterm

  • @Treczoks
    link
    -29 hours ago

    Well, the source code is available. Fix it if you need it that bad.