Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Software >> OS >> Unix >> Utilities >> vi >> how to insert a string at beginning of each line

## Get into command mode (press Esc key if not already so)

## To replace from 1st line to last line

:1$s/^/replacementstring/

or

:%s/^/replacementstring/


## To replace from current line and next 4 lines (total 5 lines)

:.,+4s/^/replacementstring/


## To replace from current line and previous 4 lines (total 5 lines)

:.,-4s/^/replacementstring/g

 

 

 

 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]