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,32 +1,25 @@
# sed
> 以可脚本的来批量编辑文本。
> 更多信息:<https://keith.github.io/xcode-man-pages/sed.1.html>.
> 以可脚本化的方式编辑文本。
> 另见:`awk``ed`。
> 更多信息:<https://keith.github.io/xcode-man-pages/sed.1.html>。
- 替换文件中第一个出现的字符串,并打印结果
- 在所有输入行中将所有 `apple`(基本正则表达式)替换为 `mango`(基本正则表达式),并将结果打印到 `stdout`
`sed 's/{{查找内容}}/{{替换内容}}/' {{文件名}}`
`{{command}} | sed 's/apple/mango/g'`
- 替换文件中所有符合正则表达式的部分
- 执行特定的脚本 [f]ile并将结果打印到 `stdout`
`sed -E 's/{{正则表达式}}/{{替换内容}}/g' {{文件名}}`
`{{command}} | sed -f {{path/to/script_file.sed}}`
- 替换文件中所有出现的字符串,覆盖文件(直接覆盖文件)
- 在所有输入行中将所有 `apple`(扩展正则表达式)替换为 `APPLE`(扩展正则表达式),并将结果打印到 `stdout`
`sed --in-place='' 's/{{查找内容}}/{{替换内容}}/g' {{文件名}}`
`{{command}} | sed -E 's/(apple)/\U\1/g'`
- 仅替换与行模式(一种搜索条件)匹配的行内容
- 只打印第一行到 `stdout`
`sed '/{{行模式}}/s/{{查找内容}}/{{替换内容}}/' {{文件名}}`
`{{command}} | sed -n '1p'`
- 只打印第 n 行到下一行之间的文本
- `file` 中将所有 `apple`(基本正则表达式)替换为 `mango`(基本正则表达式),并将原始文件备份到 `file.bak`
`sed -n '{{行号}},/^$/p' {{文件名}}`
- 将多个查找替换表达式应用于文件:
`sed -e 's/{{查找内容}}/{{替换内容}}/' -e 's/{{查找内容}}/{{替换内容}}/' {{文件名}}`
- 将分隔符 / 替换为查找或替换模式中没有用到的的任何其他字符,例如 #(用于查找或替换内容中使用了 / 的情况):
`sed 's#{{查找内容}}#{{替换内容}}#' {{文件名}}`
`sed -i bak 's/apple/mango/g' {{path/to/file}}`