One small addition to the solutions suggested by others: :%s/^[^#]/#&/
rather than :%s/^[^#]/#/ might be cleaner as the second method will replace the first character of each line, whereas the first method will prepend the # Seb ----- Original Message ----- From: Simon Wong <[EMAIL PROTECTED]> Date: Tuesday, October 1, 2002 11:27 am Subject: [SLUG] vi: commenting out all lines that aren't already > vi gurus, > > I've done some googling but couldn't find something to tell me how... > > I want to comment out every line in a file (inetd.conf) but not the > onesthat already are. > > I tried > > :1,$s/^/# > > which does every line. Looks very uncool. > > Help?! > > > > -- > ************** > * Simon Wong * > ************** > > > -- > SLUG - Sydney Linux User's Group - http://slug.org.au/ > More Info: http://lists.slug.org.au/listinfo/slug > -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
