Home
> CentOS, Linux, Red Hat, Solaris, Ubuntu > Using VI Editor to insert at the beginning/end of each line
Using VI Editor to insert at the beginning/end of each line
This replaces the beginning of each line with “replace”:
:%s!^!replace!
This replaces the beginning of each selected line (use visual mode to select) with “replace”:
:'<,’>s!^!replace!
YES you can change the symbol ! to /
:%s/^/replace/
:'<,’>s/^/replace/
This replaces the end of each line
:%s/$/replace/g
Comments (0)
Trackbacks (0)
Leave a comment
Trackback