XZGREP(1)

✨ xzgrep β€” search possibly-compressed files for patterns ✨

okay bestie, listen up πŸ’– this one's from the XZ Utils fam, it's called xzgrep, and it's literally the moment compressed files stop being a whole thing. no cap.


🌸 SYNOPSIS 🌸

xzgrep [option...]  [pattern_list] [file...]
xzegrep ...
xzfgrep ...
lzgrep ...  (DEPRECATED)
lzegrep ...  (DEPRECATED)
lzfgrep ...  (DEPRECATED)

six little names, one iconic job πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: xzgrep runs grep(1) on the uncompressed contents of your files. how does it know what's what? the filename suffixes, babe β€” it reads the vibe check off the end of the name. any file with a suffix that xz(1), gzip(1), bzip2(1), lzop(1), zstd(1), or lz4(1) supports gets decompressed on the fly. everything else? assumed to be uncompressed already. slay, no drama. ✨

if you don't name any files, or you pass - as the file, it reads standard input. but heads up β€” when it's reading from standard input, only files supported by xz(1) get decompressed. the rest are just treated as already-uncompressed content. that's the rules, i don't make them. πŸ’…

most options from grep(1) are supported, which is giving generous. HOWEVER 😭 the following ones are not supported, so don't come for me:

  • -r, --recursive
  • -R, --dereference-recursive
  • -d, --directories=action
  • -Z, --null
  • -z, --null-data
  • --include=glob
  • --exclude=glob
  • --exclude-from=file
  • --exclude-dir=glob

write those down, bestie, they will simply not work πŸ™ˆ

also!! xzegrep is an alias for xzgrep -E, and xzfgrep is an alias for xzgrep -F. same energy, different flag. 🫢

and the trio lzgrep, lzegrep, and lzfgrep? those exist purely for backward compatibility with LZMA Utils. they are deprecated and will be removed in a future version β€” so like, use them if you must, but don't get attached. πŸ’€


⭐ EXIT STATUS ⭐

  • 0 β€” at least one match was found from at least one of the input files, and no errors occurred. we ate. πŸ‘‘
  • 1 β€” no matches were found from any of the input files, and no errors occurred. it's giving empty search, but at least it was chill about it.
  • >1 β€” one or more errors occurred. and here's the messy part: it is unknown whether matches were found. 😭

πŸ’œ ENVIRONMENT πŸ’œ

  • GREP β€” if you set this to a non-empty value, that value gets used instead of grep, grep -E, or grep -F. main character energy, honestly. 🌈

πŸŽ€ SEE ALSO πŸŽ€

grep(1), xz(1), gzip(1), bzip2(1), lzop(1), zstd(1), lz4(1), zgrep(1)


and that's the whole thing, bestie πŸ’… brought to you by Tukaani, dated 2025-03-06 β€” go search something compressed, you've got this πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from