tzgrep

Crates.iotzgrep
lib.rstzgrep
version0.1.2
sourcesrc
created_at2022-10-10 06:50:37.823966
updated_at2023-04-06 14:09:45.449979
descriptiongrep tar.gz
homepage
repositoryhttps://gitlab.com/Toru3/tzgrep
max_upload_size
id684406
size28,151
(Toru3)

documentation

README

.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
Commit count: 12

cargo fmt