add new chinese translations

This commit is contained in:
2024-12-30 15:25:56 +08:00
parent a850046d7b
commit 0d798759fd
5418 changed files with 105800 additions and 7052 deletions

View File

@@ -1,36 +1,36 @@
# grep
> 使用正则表达式查找文件中模式。
> 更多信息:<https://www.gnu.org/software/grep/manual/grep.html>.
> 使用正则表达式文件中查找模式。
> 更多信息:<https://www.gnu.org/software/grep/manual/grep.html>
- 在文件中查找模式:
- 在文件中搜索模式:
`grep "{{模式字符串}}" {{路径/到/文件}}`
`grep "{{search_pattern}}" {{path/to/file}}`
- 在文件中精确地查找字符串(禁用正则表达式):
- 搜索确切字符串(禁用正则表达式):
`grep {{-F|--fixed-strings}} "{{字符串}}" {{路径/到/文件}}`
`grep {{-F|--fixed-strings}} "{{exact_string}}" {{path/to/file}}`
-指定目录下的所有文件中递归地查找模式,显示匹配的行号忽略二进制文件:
-目录中递归搜索所有文件中的模式,显示匹配的行号忽略二进制文件:
`grep {{-r|--recursive}} {{-n|--line-number}} --binary-files {{without-match}} "{{模式字符串}}" {{路径/到/目录}}`
`grep {{-r|--recursive}} {{-n|--line-number}} --binary-files {{without-match}} "{{search_pattern}}" {{path/to/directory}}`
- 使用大小写不敏感的扩展正则表达式(支持 `?``+``{}``()``|`
- 使用扩展正则表达式(支持 `?``+``{}``()``|`,以不区分大小写的模式
`grep {{-E|--extended-regexp}} {{-i|--ignore-case}} "{{模式字符串}}" {{路径/到/文件}}`
`grep {{-E|--extended-regexp}} {{-i|--ignore-case}} "{{search_pattern}}" {{path/to/file}}`
- 每个匹配前后、之前或之后打印 3 行上下文
- 打印每个匹配项上下文的3行内容或在匹配项之前或之后的内容
`grep --{{context|before-context|after-context}} 3 "{{模式字符串}}" {{路径/到/文件}}`
`grep --{{context|before-context|after-context}} 3 "{{search_pattern}}" {{path/to/file}}`
- 以带有颜色的方式,打印每个匹配文件名和行号:
- 对于每个匹配项打印文件名和行号,并带有颜色输出
`grep {{-H|--with-filename}} {{-n|--line-number}} --color=always "{{模式字符串}}" {{路径/到/文件}}`
`grep {{-H|--with-filename}} {{-n|--line-number}} --color=always "{{search_pattern}}" {{path/to/file}}`
- 只打印文件中与模式匹配的行
- 搜索匹配模式的行,仅打印匹配文本
`grep {{-o|--only-matching}} "{{模式字符串}}" {{路径/到/文件}}`
`grep {{-o|--only-matching}} "{{search_pattern}}" {{path/to/file}}`
- `stdin`(标准输入)中查找与模式不匹配的行:
- `stdin` 中搜索不匹配模式的行:
`cat {{路径/到/文件}} | grep {{-v|--invert-match}} "{{模式字符串}}"`
`cat {{path/to/file}} | grep {{-v|--invert-match}} "{{search_pattern}}"`