Date: Thu, 14 Oct 2004 17:16:24 -0500 From: Paul Schmehl <pauls@utdallas.edu> To: Mark Jayson Alvarez <jay2xra@yahoo.com>, freebsd-questions@freebsd.org Subject: Re: commenting/uncommenting a particular line in place Message-ID: <A74BDDDDF829725579C6F98F@utd49554.utdallas.edu> In-Reply-To: <20041014080223.26811.qmail@web51601.mail.yahoo.com> References: <20041014080223.26811.qmail@web51601.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--On Thursday, October 14, 2004 01:02:23 AM -0700 Mark Jayson Alvarez <jay2xra@yahoo.com> wrote: > Good Day, > I'm looking for a command combinations (not and > editor) that would uncomment or comment a line in any > configuration file such as inetd.conf with just one > single stroke. > > For example here's the line in inetd.conf that will > enable ftpd: > > ># ftp stream tcp nowait root > /usr/libexec/ftpd ftpd -l > > sure, I can extract that particular line using cat and > grep, but I'm not quit sure how am I going to edit it. > > If it is commented by default, I can just say: > cat /etc/inetd.conf |grep #ftp |grep -v 6 |sed -e > 's/#//' to extract and edit that particular line and > then pipe the output to 'tee -a' to be able to append > it at the bottom of inetd.conf. > > But what if it's already uncommented? What's wrong with what you've already got? cat /etc/inetd.conf | grep -v "#" | grep ftp | grep -v 6 | sed -e 's//#/' Paul Schmehl (pauls@utdallas.edu) Adjunct Information Security Officer The University of Texas at Dallas AVIEN Founding Member http://www.utdallas.edu
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A74BDDDDF829725579C6F98F>