Learning ed

If you use the ed editor, you work in either command mode or text-input mode, as the following list explains:

♦ Command mode is what you get by default. In this mode, ed interprets anything that you type as a command. As you see in the section "Summarizing ed Commands," later in this chapter, ed uses a simple command set, wherein each command consists of a single character.

♦ Text-input mode enables you to enter text into the buffer. You can enter input mode by using the commands a (append), c (change), or i (insert). After entering lines of text, you can leave text-input mode by entering a period (.) on a line by itself.

The ed editor embodies the concept of the current line —the line to which ed applies the commands that you type. Each line has an address: the line number. You can apply a command to a range of lines by prefixing the command with an address range. The p command, for example, prints (displays) the current line. To see the first ten lines, use the following command:

In a command, the period (.) refers to the current line, and the dollar sign ($) refers to the last line in the file. Thus, the following command deletes all the lines from the current line to the last one:

1,10p

Was this article helpful?

0 0
Make Money Writing

Make Money Writing

This Report Will Show You How To Make Money By Providing Writing Services To Other Internet Marketers. Learn how to make money by writing the right way. Grab your copy of this report now and learn. Why writing is a great way to earn money. How to compete with cheap writers, even if you charge a lot more money.

Get My Free Ebook


Post a comment