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. ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.