Use of the Linux ed command

Source: Internet
Author: User
Linux edUse of editor Original: http://www.matrix.org.cn/thread.shtml? Topicid = 28281 & forumid = 43
EdThe editor is
Linux
The simplest text editor in the operating system. It is an editor that edits a file in units of action, not an editor in a MS-DOS system that edits the file in units of the entire screen frame. Therefore, if you are used to the edit Editor, it may take some time to get used to it.
Ed. But this is not important, because
Ed
Ease of use can make you get started quickly.

EdThe editor is easy to call. If you want to create a new file, you only need to input
EdThen press the Enter key:
[Titan @ localhost Titan] $Ed<-

If you want to edit an existing fileEdEnter a file name:

[Titan @ localhost Titan] $EdFilename <-

ActivateEdThe command is
Ed
The command line status of the editor, which may make some beginners unfamiliar. If you enter some content at this time, the system will return ?, Indicates that you do not know what task to execute:
[Titan @ localhost Titan] $Ed<-

ABCDE <-
?

At this time, you need to specify several editor commands, which are:
A-add new content at the end of the file
I-Insert new content before the last row of the file
O-Replace the last line (whether existing or inserted) of the input file with the new content.
.-Exit the file editing mode and enter the command line mode (Note: The file is not exited at this time.
Ed
Editor)
W-save the file
Q-exitEdEditor

The following is an example of several commands.
[Titan @ localhost Titan] $Ed<-Activation
EdCommand
A <-tellEdI want to edit a new file

My name is Titan. <-enter the content of the first line.
And I love Perl very much. <-enter the second line of content
. <-ReturnEdCommand Line status
I <-tellEdI want to insert content before the last line

I am 24. <-insert "I am 24." between "My Name Is Titan." and "and I love Perl very much ."
. <-ReturnEdCommand Line status
C <-tellEdI want to replace the input content of the last line

I am 24 years old. <-Replace "I am 24." with "I am 24 years old." (Note: The last input is replaced here)
. <-ReturnEdCommand Line status
W readme. Text <-name the file "readme. Text" and save it. (Note: If you are editing an existing file, you only need to enter W)
Q <-completely exitEdEditor
[Titan @ localhost Titan] $ returns
Linux
Command Line STATUS OF THE SYSTEM
The content of this file is:
[Titan @ localhost Titan] $ cat readme. Text <-
My name is Titan.
I am 24 years old.
And I love Perl vrey much.
[Titan @ localhost Titan] $

BecauseEdEditing a file always does not see the file content, and it is not as flexible as the edit under the MS-DOS, please be sure to carefully check the input content in the editing file to ensure its correctness, this avoids repeated switching between the editing status and the command line status, which wastes a lot of time.

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 1655607

  Linux edUse of editor Original: http://www.matrix.org.cn/thread.shtml? Topicid = 28281 & forumid = 43
EdThe editor is
Linux
The simplest text editor in the operating system. It is an editor that edits a file in units of action, not an editor in a MS-DOS system that edits the file in units of the entire screen frame. Therefore, if you are used to the edit Editor, it may take some time to get used to it.
Ed. But this is not important, because
Ed
Ease of use can make you get started quickly.

EdThe editor is easy to call. If you want to create a new file, you only need to input
EdThen press the Enter key:
[Titan @ localhost Titan] $Ed<-

If you want to edit an existing fileEdEnter a file name:

[Titan @ localhost Titan] $EdFilename <-

ActivateEdThe command is
Ed
The command line status of the editor, which may make some beginners unfamiliar. If you enter some content at this time, the system will return ?, Indicates that you do not know what task to execute:
[Titan @ localhost Titan] $Ed<-

ABCDE <-
?

At this time, you need to specify several editor commands, which are:
A-add new content at the end of the file
I-Insert new content before the last row of the file
O-Replace the last line (whether existing or inserted) of the input file with the new content.
.-Exit the file editing mode and enter the command line mode (Note: The file is not exited at this time.
Ed
Editor)
W-save the file
Q-exitEdEditor

The following is an example of several commands.
[Titan @ localhost Titan] $Ed<-Activation
EdCommand
A <-tellEdI want to edit a new file

My name is Titan. <-enter the content of the first line.
And I love Perl very much. <-enter the second line of content
. <-ReturnEdCommand Line status
I <-tellEdI want to insert content before the last line

I am 24. <-insert "I am 24." between "My Name Is Titan." and "and I love Perl very much ."
. <-ReturnEdCommand Line status
C <-tellEdI want to replace the input content of the last line

I am 24 years old. <-Replace "I am 24." with "I am 24 years old." (Note: The last input is replaced here)
. <-ReturnEdCommand Line status
W readme. Text <-name the file "readme. Text" and save it. (Note: If you are editing an existing file, you only need to enter W)
Q <-completely exitEdEditor
[Titan @ localhost Titan] $ returns
Linux
Command Line STATUS OF THE SYSTEM
The content of this file is:
[Titan @ localhost Titan] $ cat readme. Text <-
My name is Titan.
I am 24 years old.
And I love Perl vrey much.
[Titan @ localhost Titan] $

BecauseEdEditing a file always does not see the file content, and it is not as flexible as the edit under the MS-DOS, please be sure to carefully check the input content in the editing file to ensure its correctness, this avoids repeated switching between the editing status and the command line status, which wastes a lot of time.

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 1655607

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.