Skip to content

Commit

Permalink
keep stdout no translated
Browse files Browse the repository at this point in the history
  • Loading branch information
zjuyk committed May 29, 2024
1 parent bf1e59f commit bd093ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages.zh/linux/sed.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
> 参见:`awk`, `ed`.
> 更多信息:<https://www.gnu.org/software/sed/manual/sed.html>.
- 将所有输入行中出现的 `apple`(基本正则语法)替换为 `mango`(基本正则语法),并将结果打印到 `标准输出`
- 将所有输入行中出现的 `apple`(基本正则语法)替换为 `mango`(基本正则语法),并将结果打印到 `stdout`

`{{命令}} | sed 's/apple/mango/g'`

- 将所有输入行中出现的 `apple`(扩展正则语法)替换为 `APPLE` (扩展正则语法),并将结果打印到 `标准输出`
- 将所有输入行中出现的 `apple`(扩展正则语法)替换为 `APPLE` (扩展正则语法),并将结果打印到 `stdout`

`{{命令}} | sed -E 's/(apple)/\U\1/g'`

-`mango`(基本正则语法)替换特定文件中出现的所有 `apple`(基本正则语法),并覆盖原文件:

`sed -i 's/apple/mango/g' {{文件路径}}`

- 执行特定的脚本,并将结果打印到 `标准输出`
- 执行特定的脚本,并将结果打印到 `stdout`

`{{命令}} | sed -f {{sed 脚本路径}}`

- 打印第一行到 `标准输出`
- 打印第一行到 `stdout`

`{{命令}} | sed -n '1p'`

Expand Down

0 comments on commit bd093ab

Please sign in to comment.