Files
tldr/pages.zh/common/zgrep.md
Jin e5305a1865 common/z*: add Chinese translation (#14773)
* common/z*: add Chinese translation

* Update zoxide.md

* Update zoxide.md
2024-12-03 22:52:45 -08:00

33 lines
989 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# zgrep
> 在压缩文件中从文件中 grep 文本模式(等价于 `grep -Z`)。
> 更多信息:<https://manned.org/zgrep>.
- 在压缩文件中 grep 一个模式(区分大小写):
`zgrep {{模式}} {{路径/到/压缩/文件}}`
- 在压缩文件中 grep 一个模式(不区分大小写):
`zgrep -i {{模式}} {{路径/到/压缩/文件}}`
- 输出包含匹配模式的行数:
`zgrep -c {{模式}} {{路径/到/压缩/文件}}`
- 显示不包含该模式的行(反转搜索功能):
`zgrep -v {{模式}} {{路径/到/压缩/文件}}`
- 在压缩文件中为多个模式执行 grep
`zgrep -e "{{模式_1}}" -e "{{模式_2}}" {{路径/到/压缩/文件}}`
- 使用扩展的正则表达式(支持 `?``+``{}``()``|`
`zgrep -E {{正则表达式}} {{路径/到/文件}}`
- 打印每个匹配项前后各 3 行的上下文([C]ontent、[B]efore 或 [A]fter
`zgrep -{{C|B|A}} {{3}} {{模式}} {{路径/到/压缩/文件}}`