4 releases
0.2.0 | Oct 20, 2024 |
---|---|
0.1.2 | Apr 6, 2023 |
0.1.1 | Oct 10, 2022 |
0.1.0 | Oct 10, 2022 |
#661 in Text processing
137 downloads per month
13KB
268 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
~7–16MB
~203K SLoC