linux-command/command/ed.md

41 lines
1.0 KiB
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.

ed
===
单行纯文本编辑器
## 补充说明
**ed命令** 是单行纯文本编辑器它有命令模式command mode和输入模式input mode两种工作模式。ed命令支持多个内置命令常见内置命令如下
### 语法
```shell
ed(选项)(参数)
```
### 选项
```shell
A # 切换到输入模式,在文件的最后一行之后输入新的内容;
C # 切换到输入模式,用输入的内容替换掉最后一行的内容;
i # 切换到输入模式,在当前行之前加入一个新的空行来输入内容;
d # 用于删除最后一行文本内容;
n # 用于显示最后一行的行号和内容;
w # <文件名>:一给定的文件名保存当前正在编辑的文件;
q # 退出ed编辑器。
```
```shell
-G或——traditional提供兼容的功能
-p<字符串>指定ed在command mode的提示字符
-s---quiet或——silent不执行开启文件时的检查功能
--help显示帮助
--version显示版本信息。
```
### 参数
文件:待编辑的文件。