grep inside zips, PDFs and sqlite files, not just plain text
ripgrep-all (rga) wraps ripgrep with transparent preprocessors for zip/tar/gz archives, PDFs, Office docs, and sqlite databases — the pattern matches inside the compressed/binary content without a manual unzip-then-grep step. --json streams the same match objects ripgrep itself would, so it slots straight into a jq pipeline instead of scrollback.
Setup
- → cargo install ripgrep_all # or: brew install ripgrep-all
Cost per run
free
The one-liner
$ rga --json "aws_secret_access_key" . | jq -c 'select(.type=="match") | .data.path.text' | sort | uniq -cWhat each stage does
- [01] rga
rga --json "aws_secret_access_key" .Recursively search every file under the current directory for the pattern — including inside .zip archives, which rga transparently decompresses and greps in-memory. --json streams one ripgrep-format JSON event per line (begin/match/end/summary). - [02] jq
jq -c 'select(.type=="match") | .data.path.text'Keep only "match" events and pull the containing file's path — for a hit inside an archive member, this is still the archive's own path (e.g. backup.zip), since that's what you'd actually go open. - [03] sort/uniq
sort | uniq -cCount matches per archive, turning a wall of hits into a ranked "which backups have this secret" summary.
Expected output (sample)
1 "./backup-2026-07.zip"
2 "./backup-2026-09.zip"Caveats & tips
- Verified on ripgrep-all 0.10.10 (cargo install ripgrep_all), run for real against 3 local zip archives seeded with a fake AWS-shaped key string — output above is real, unmodified stdout (backup-2026-08.zip has no match and correctly doesn't appear).
- First run per archive is slower than plain ripgrep — rga caches extracted/preprocessed content in a local cache dir so repeat searches over the same files are fast.
- PDF/Office/sqlite support needs their respective preprocessors on PATH (pandoc, poppler-utils, sqlite3); the zip/tar/gz path used here works with zero extra dependencies beyond rga itself.
- This is a real secret-scanning use case, not just a novelty — swap the pattern for any credential/PII shape before archiving old exports, or for a one-off grep across old .tar.gz project backups you haven't extracted in years.