Cutting and Pasting
One of the more common deletion-oriented edits made when working with an existing file is the cut-and-paste operation. This is useful when you have a few lines of the file that need to be moved to another area of the file. You typically cut the section to be moved, and then place it in a temporary buffer (the GPB). Next, you move the cursor to the location you want the data to be placed, and then paste it into its new home.
The sequence involves a dd command, followed by moving the cursor and entering the p command. If you want to move more than one line, you can use a line count in front of the dd command:
3dd
(move cursor)
p
The p command pastes the contents of the GPB on the line below the line on which the cursor sits. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access