ed

Estimate Departure time Estimated take-off time; Engineering Development Engineering development; Effective Dose Effective dose

Linuxedcommand syntax

Function: The ed command is a text editor, used for text editing. ed is the simplest text editing program in Linux. It can only edit one line at a time instead of full-screen operation.

Syntax: ed [-][-Gs][-p<string>][--help][--version][file]

Linuxedcommand example

The following is a complete example analysis of Linux ed:

$ ed              <- 激活 ed 命令 
a                 <- 告訴 ed 我要編輯新文件 
My name is Titan. <- 輸入第一行內(nèi)容 
And I love Perl very much. <- 輸入第二行內(nèi)容 
.                 <- 返回 ed 的命令行狀態(tài)
i                 <- 告訴 ed 我要在最后一行之前插入內(nèi)容 
I am 24.          <- 將“I am 24.”插入“My name is Titan.”和“And I love Perl very much.”之間 
.                 <- 返回 ed 的命令行狀態(tài) 
c                 <- 告訴 ed 我要替換最后一行輸入內(nèi)容 
I am 24 years old. <- 將“I am 24.”替換成“I am 24 years old.”(注意:這里替換的是最后輸?shù)膬?nèi)容) 
.                 <- 返回 ed 的命令行狀態(tài) 
w readme.text     <- 將文件命名為“readme.text”并保存(注意:如果是編輯已經(jīng)存在的文件,只需要敲入 w 即可) 
q                 <- 完全退出 ed 編輯器

This is the content of the file:

$ cat readme.text 
My name is Titan. I am 24 years old. And I love Perl vrey much.