Re: commenting/uncommenting a particular line in place

2004-10-14 Thread Paul Schmehl
--On Thursday, October 14, 2004 01:02:23 AM -0700 Mark Jayson Alvarez 
<[EMAIL PROTECTED]> 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:
# ftpstream  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 ([EMAIL PROTECTED])
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


commenting/uncommenting a particular line in place

2004-10-14 Thread Mark Jayson Alvarez
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:


#ftpstream  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? I know a little
bit of perl and I'm thinking of reading the entire
inetd.conf line by line and then when I hit that
certain line, insert a # in front of it, all being
done while writing it to another file and then
replacing the original inetd.conf after everything has
been written. 

Do you have any idea how it is done without using
perl, perhaps with command combinations etc.. 

Thanks for the time.










___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"