Linux command
bzfgrep 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Search for a fixed string in a bzip2 compressed file
bzfgrep "[string]" [path/to/file.bz2]
Search case-insensitively
bzfgrep -i "[string]" [path/to/file.bz2]
Print line numbers with matches
bzfgrep -n "[string]" [path/to/file.bz2]
Search multiple compressed files
bzfgrep "[string]" [file1.bz2] [file2.bz2]
Count matching lines
bzfgrep -c "[string]" [path/to/file.bz2]
说明
bzfgrep searches possibly bzip2-compressed files for lines matching a fixed string pattern. It transparently decompresses .bz2 files before searching and passes all options directly to fgrep. Unlike bzgrep or bzegrep, bzfgrep interprets the pattern as a literal string rather than a regular expression. This makes it faster for simple string searches and avoids the need to escape special characters. If no file is specified, bzfgrep reads from standard input, decompressing if necessary.
参数
- -i
- Case-insensitive matching
- -n
- Print line numbers
- -c
- Print only a count of matching lines
- -v
- Invert match (show non-matching lines)
- -l
- Print only filenames containing matches
- -e _pattern_
- Specify the pattern (useful if pattern starts with -)
FAQ
What is the bzfgrep command used for?
bzfgrep searches possibly bzip2-compressed files for lines matching a fixed string pattern. It transparently decompresses .bz2 files before searching and passes all options directly to fgrep. Unlike bzgrep or bzegrep, bzfgrep interprets the pattern as a literal string rather than a regular expression. This makes it faster for simple string searches and avoids the need to escape special characters. If no file is specified, bzfgrep reads from standard input, decompressing if necessary.
How do I run a basic bzfgrep example?
Run `bzfgrep "[string]" [path/to/file.bz2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i do in bzfgrep?
Case-insensitive matching