Archive for May, 2010

VI Cheat Sheet

Monday, May 17th, 2010

Replace commas (or something) with line breaks (or something)

:%s/,/^M/g
where ^M = ctrl+V & ctrl+M

Use vi to comment out (or do something else to) several consecutive lines

Example: If you wanted to comment out lines 20 to 40 of a file, use the following:

:20,40s/^/# /

Use

:set number

to enable visible line numbers.

Problem with “terminal too wide” been plaguing you on those farty old Solaris boxes for the last 6.5 years but you were usually too busy doing something else to stop it from ever happening again?

Tuesday, May 11th, 2010

Well you can install VIM, or if that’s not practical (or if you’re not in the mood to install VIM and its required dependencies on the hundred or so boxes you log into), then the command “stty columns 120” will do ya.