Thursday, October 20, 2011

Deleting text with "vi" editor

While in command mode there are few commands provided by UNIX to delete the text from the file.

<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.
do it, too.
UNIX, by contrast, is much more like a spoken language, with
command options (which you learn about later in this lesson)
more complex commands acting akin to sentences. How you do a specific task can, therefore,
(pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>

Try entering "dd" which deletes an entire line and shift the lines up
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.
UNIX, by contrast, is much more like a spoken language, with
command options (which you learn about later in this lesson)
more complex commands acting akin to sentences. How you do a specific task can, therefore,
(pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>

"2dd" - will delete two lines
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.
more complex commands acting akin to sentences. How you do a specific task can, therefore,
(pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>

 "D" - Delete the line to the right of the cursor
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.
_

(pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>

Here after entering "D", we have
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system_
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


Now let us tweek a little of the "d" commnad
when "w" (word) is used with "d", dw this delete word by word


What is the command in Unix equivalent to delete and Backspace that we use in windows?
x - Deletes the text as like how we use the "delete" button in windows
X [<-] - Deletes the text as like when we use the backspace in windows.


What if you need to undo the delete?
You can undo only the last action using "u"

Example Scenario:
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>

type dw

<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


type "D"
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system_
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


type "u"
<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


type "U"

<<file content>>
you can learn the one-and-only
in doing that task as is the next person. It.s easy.

pronounce that .system five release four. or, to sound like an ace, .ess-vee-are-four.), and
BSD UNIX (pronounced .bee-ess-dee.) from University of California at Berkeley are the
<<>>


You can see that entire line is replaced. This can be achieved only if you hadn't moved from the line which you are editing.

Change the case of the letter
Use the command tild (~) or "delete" button in your keyboard.

No comments:

Post a Comment