Output count of lines containing matched pattern in a compressed file

zgrep

  • Grep text patterns from files within compressed file (equivalent to grep -Z).
    More information: <https://manned.org/zgrep>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

zgrep -c {{pattern}} {{path/to/compressed/file}}

click the source code to copy install zgrep on any operating system with command-not-found.com