Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

Linux. Vi / Vim string substitution

In command mode.

:1,$s/Section/Chapter/g

replaces every occurrence of the string "Section" with the string "Chapter" from line 1 in the file through the buffer ($) - use . for to current line. The "/g" indicates that "Section" should be replaced by "Chapter" every time on a line

get rid of all links on a page.

:%s/<a.*">//g
:%s/<\/a>//g

Insert Carrage return at end of each paragragh:

:%s/<\/p>/<\/p>^M/

(^M is CTL-V followed by Carrage return (CR))

Convert Mac documents to Unix

:%s/^M/^M/g

Strip all HTML from a document

:s/<[^>]*>//g

Remove blank lines

:g/^$/d

Share this!