3 releases

0.1.2 Apr 6, 2023
0.1.1 Oct 10, 2022
0.1.0 Oct 10, 2022

#1416 in Text processing

Download history 16/week @ 2024-02-23 14/week @ 2024-03-01 37/week @ 2024-03-29 3/week @ 2024-04-05 95/week @ 2024-04-12

135 downloads per month

AGPL-3.0-or-later

12KB
257 lines

.Tar.Gz GREP

Why I made this tool

$ time tar xf test_data.tar -O | rg hogeP # fast but no filename
gRRay4bho5P4hZZWvBDCX50cX2fJAyLNhogePvGaFWwaPFdmi3Y8zvJai2OLpQ13+tZB2zm8KbAI

real	0m1.392s
user	0m0.828s
sys	0m1.513s
$ tar xf test_data.tar '--to-command=grep --label=$TAR_FILENAME -H hogeP; true' # extremely slow
test_data/863227.txt:gRRay4bho5P4hZZWvBDCX50cX2fJAyLNhogePvGaFWwaPFdmi3Y8zvJai2OLpQ13+tZB2zm8KbAI

real	24m21.333s
user	20m9.365s
sys	4m32.069s
$ tzgrep hogeP test_data.tar # very fast with filename
test_data/863227.txt:gRRay4bho5P4hZZWvBDCX50cX2fJAyLNhogePvGaFWwaPFdmi3Y8zvJai2OLpQ13+tZB2zm8KbAI

real	0m0.644s
user	0m0.475s
sys	0m0.168s

Usage

$ tzgrep --help
grep tar.gz

Usage: tzgrep [OPTIONS] <PATTERN> [FILE]

Arguments:
  <PATTERN>
          search pattern [regular expression](https://crates.io/crates/regex)

  [FILE]
          search target. If not presented read from stdin.
          
          .tar, .tar.gz, .tar.bz2, .tar.xz, .tar.zst are supported

Options:
  -n, --line-number
          print line number with output lines

  -F, --fixed-string
          Asuume search pattern to be fixed string

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Dependencies

~11MB
~186K SLoC