bzgrep
Quick Reference
Command Name:
bzgrep
Category:
file search
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Compressed file searching
Search for patterns in bzip2 compressed files
- 2
Data mining
Extract specific information from compressed data
- 3
Log analysis
Search compressed log files for specific entries
- 4
Content filtering
Filter compressed content based on patterns
Syntax
bzgrep [OPTIONS] PATTERN [FILE...] bzfgrep [OPTIONS] PATTERN [FILE...] bzegrep [OPTIONS] PATTERN [FILE...]
Options
Option | Description |
---|---|
-a, --text | Process binary files as if they were text |
-c, --count | Print only a count of matching lines per file |
-E, --extended-regexp | Interpret PATTERN as an extended regular expression |
-F, --fixed-strings | Interpret PATTERN as a list of fixed strings |
-G, --basic-regexp | Interpret PATTERN as a basic regular expression (default) |
-h, --no-filename | Suppress the file name prefix on output |
-i, --ignore-case | Ignore case distinctions in both the PATTERN and the input files |
-l, --files-with-matches | Print only names of files containing matches |
-L, --files-without-match | Print only names of files containing no match |
-n, --line-number | Print line number with output lines |
-v, --invert-match | Select non-matching lines |
-w, --word-regexp | Match only whole words |
-A NUM, --after-context=NUM | Print NUM lines of trailing context after matching lines |
-B NUM, --before-context=NUM | Print NUM lines of leading context before matching lines |
-C NUM, --context=NUM | Print NUM lines of output context |
Examples
How to Use These Examples
The examples below show common ways to use the bzgrep
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
bzgrep "error" logfile.bz2
bzgrep -i "warning" logfile.bz2
bzgrep -w "fail" logfile.bz2
bzgrep -n "exception" errors.log.bz2