How to comment all lines in VI editor ?
This can be done with a using a command like ‘search and replace’1.Open the file in ‘vi’ editor.2.Press Escape and type :1,$s/^/##/g3.Press Enter 1,$s/^/##/g can be broken down as1: To start from 1st line $s :To end at the last line/^ : Search for the start of the line/##:Replace with ##/g: Replace all occurrences