How will you perform the following in vi?i) To search and replace all occurences of pattern1 with pattern2ii) insert text (and enter input mode)iii) append text (to end of line)iv) Move to beginning of linev) Move to the end of line

i)
To search and replace all occurences of pattern1 with pattern2, type : 
%s/pattern1/pattern2/g
 
To be asked to confirm each replacement, add a c to this substitution command. Instead of the % you can alsogive a range of lines (e.g. 1,17) over which you want the substitution to apply.
 
iv) Use these Command mode keystrokes to move around within the file:
          0    Move to the beginning of the current line.
 
v) Use these Command mode Keystrokes to move around within the file
          $   Move to the end of the current line
How will you perform the following in vi?i) To search and replace all occurences of pattern1 with pattern2ii) insert text (and enter input mode)iii) append text (to end of line)iv) Move to beginning of linev) Move to the end of line How will you perform the following in vi?i) To search and replace all occurences of pattern1 with pattern2ii) insert text (and enter input mode)iii) append text (to end of line)iv) Move to beginning of linev) Move to the end of line Reviewed by enakta13 on November 22, 2012 Rating: 5

Search your question

Powered by Blogger.