Vi search and replace tricks

Double spacing: :%s/$/{ctrl-V}{CR}/g This command applies an extra carriage return at the end of all lines Strip blanks at end of line: :%s/{TAB}*$// Delete all lines beginning with or matching a pattern: :1,$ /^#/d Delete all (first to last line: 1,$ or g) comments lines in file. Delete all lines beginning (^) with "#" (specify … Continue reading Vi search and replace tricks

Advertisements