If you can see this check that

next section prev section up prev page next page

Moving text

To move a block of text from one location to another you can use the delete and put commands. You must be in command mode to achieve this. Suppose you have the following text that you wish to put in the correct order and correct the spelling mistake also. You can do the following:


This is the first line of text.
This is the third line of text.
This is the fourth line of text.
This is the second line of tetx.

  1. Place the cursor anywhere on the line "This is the second line of tetx.". Type dd to delete the entire line.
  2. Move the cursor up and position it anywhere on the first line. Type p to put the deleted text after line one. The text should look as follows.
    
    This is the first line of text.
    This is the second line of tetx.
    This is the third line of text.
    This is the fourth line of text.
    
    
    To correct the transposition error (tetx) in the second line, move the cursor under the 't' in 'tx' and type xp. Typing x deletes the 't'; typing p puts the 't' after the cursor.
p (lowercase p)
Put deleted text below the cursor
P (uppercase p)
Put deleted text above the cursor
xp
Transpose two characters (put deleted character after cursor)

Centos 7 intro: Paths | BasicShell | Search
Linux tutorials: intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail
Caine 10.0: Essentials | Basic | Search | Acquisition | SysIntro | grep | MBR | GPT | FAT | NTFS | FRMeta | FRTools | Browser | Mock Exam |
CPD: Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis
Kali: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 |
Kali 2020-4: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7 | 8a | 8b | 9 | 10 |
Useful: Quiz | Forums | Privacy Policy | Terms and Conditions

Linuxzoo created by Gordon Russell.
@ Copyright 2004-2023 Edinburgh Napier University