2025-03-14 21:59:59 -06:00
|
|
|
# zfgrep
|
|
|
|
|
|
|
|
|
|
> Matches fixed strings in possibly compressed files.
|
2025-05-08 12:26:01 -06:00
|
|
|
> Equivalent to `grep --fixed-strings` with input decompressed first if necessary.
|
2025-03-14 21:59:59 -06:00
|
|
|
> More information: <https://manned.org/zfgrep>.
|
|
|
|
|
|
|
|
|
|
- Search for an exact string in a file:
|
|
|
|
|
|
|
|
|
|
`zfgrep {{search_string}} {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Count the number of lines that match the given string in a file:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`zfgrep {{[-c|--count]}} {{search_string}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Show the line number in the file along with the matching lines:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`zfgrep {{[-n|--line-number]}} {{search_string}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Display all lines except those that contain the search string:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`zfgrep {{[-v|--invert-match]}} {{search_string}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- List only filenames whose content matches the search string at least once:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`zfgrep {{[-l|--files-with-matches]}} {{search_string}} {{path/to/file1 path/to/file2 ...}}`
|