zfgrep
Quick Reference
Command Name:
zfgrep
Category:
file management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
Syntax
zfgrep [options] pattern [file...]
Options
The zfgrep command accepts the same options as the regular fgrep command, since it's a wrapper around fgrep for compressed files:
Option | Description |
---|---|
-A NUM |
Print NUM lines of trailing context after matching lines |
-B NUM |
Print NUM lines of leading context before matching lines |
-C NUM |
Print NUM lines of output context |
-c |
Print only a count of matching lines per file |
-F |
Interpret pattern as a fixed string (implied by zfgrep) |
-e PATTERN |
Use PATTERN as the pattern (useful when pattern starts with -) |
-f FILE |
Obtain patterns from FILE, one per line |
-i |
Ignore case distinctions |
-l |
Print only names of files with matches |
-n |
Print line number with output lines |
-v |
Select non-matching lines |
-w |
Match only whole words |
-x |
Match only whole lines |
--color |
Use markers to highlight the matching strings |
Supported File Formats
The zfgrep command can handle compressed file formats:
Extension | Format |
---|---|
.gz |
gzip compressed files |
.Z |
compress (LZW) compressed files (on some systems) |
Examples
How to Use These Examples
The examples below show common ways to use the zfgrep
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.