1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.zh/common/zegrep.md

29 lines
961 B
Markdown
Raw Normal View History

# zegrep
> 使用 `egrep` 在压缩文件中查找扩展正则表达式模式。
> 更多信息:<https://www.unix.com/man-page/freebsd/1/zegrep/>.
- 在压缩文件中搜索扩展正则表达式(支持 `?`, `+`, `{}`, `()``|`),区分大小写:
`zegrep "{{搜索模式}}" {{路径/到/文件}}`
- 在压缩文件中搜索扩展正则表达式(支持 `?`, `+`, `{}`, `()``|`),忽略大小写:
`zegrep --ignore-case "{{搜索模式}}" {{路径/到/文件}}`
- 搜索不匹配模式的行:
`zegrep --invert-match "{{搜索模式}}" {{路径/到/文件}}`
- 打印每个匹配项的文件名和行号:
`zegrep --with-filename --line-number "{{搜索模式}}" {{路径/到/文件}}`
- 搜索匹配模式的行,仅打印匹配的文本:
`zegrep --only-matching "{{搜索模式}}" {{路径/到/文件}}`
- 在压缩文件中递归搜索文件中的模式:
`zegrep --recursive "{{搜索模式}}" {{路径/到/文件}}`