Vi Editor Search Copy Paste Replace Different Mode Using sed Command

Vi Editor it has the Three Mode
Command mode
Command Mode it is default one.
While we open the file using vi command it is in the command mode.
It can be used for entering the Data in the vi editor.

H, j,k, l character it is used to move the left, right, top,bottom,
) Next ( pervious Word
} Next { pervious Paragraph
arch copy Paste Replace Basic Tricks Tipsyy copy line
5yy copy 5 lines
p paste the link
p Next P Previous Paste of the current Text

:G Go to the the Last Line
:u undo
:/'search word' ( n next Occurrence N Pervious occurrence)

dd Delete line
5dd Delete the 5 Lines
dw delete word
5dw delete the 5 word

Command Line mode
<Exc>+: while press these two key Esc + Semi colon : it will go to the command line mode.
:set nu set number
:set number set number
:set nonu Remove the Number
:/ search the Text
n Next N Opposite Direction Search Word
:%s/seracth_text/Replace_text/g


sed 's/AllowToUpdateStatsFromBrowser= 1/AllowToUpdateStatsFromBrowser= 0/g' search >> just modify and produce the result but not save in the file
sed -i 's/AllowToUpdateStatsFromBrowser= 1/AllowToUpdateStatsFromBrowser= 0/g' * it will change to all the file>
-i edit the file and save the file
sed -i ‘s/SAERCH_KEY_WORD/REPLACE_KEY_WORD/g’ file name


Sort the the Text
:.,$ !sort
nsert / Text mode
By using this mode we can enter and type the Data.
Vi Editor View the more than One files
[root@localhost ~]# vim -p rhel5 rhel6 rhel7
For changing the one window to another window
Command Line Mode
:tabn Next :tabp Previous
In the command mode
gt-Next

Post a Comment

0 Comments