Re: Using sed or awk to remove #'s from commented lines.
From: Kevin Rodgers (ihs_4664_at_yahoo.com)
Date: 06/03/03
- Next message: Barry Margolin: "Re: Infamous bash "binary operator expected""
- Previous message: Milo Thurston: "zsh completion in subdirectories"
- In reply to: MAL: "Re: Using sed or awk to remove #'s from commented lines."
- Next in thread: Chuck Geigner: "Re: Using sed or awk to remove #'s from commented lines."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 03 Jun 2003 09:53:11 -0600
MAL wrote:
> Jim wrote:
>
>> I'm writing a simple shell script that scans some config files to make
>> sure that certain settings are on or off. For example, if I have the
>> following line in inetd.conf:
>>
>> # ftp stream tcp nowait root /usr/sbin/tcpd vsftpd
>>
>> How can I use sed or awk to remove only the comment so that the
>> service will be started when inetd is restarted?
...
> sed 's/^# *ftp//' /etc/inetd.conf
That will delete the service name (ftp) as well. To delete just the comment
character (#) and any intervening spaces:
sed 's/^# *\(ftp\)/\1/' /etc/inetd.conf
-- <a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
- Next message: Barry Margolin: "Re: Infamous bash "binary operator expected""
- Previous message: Milo Thurston: "zsh completion in subdirectories"
- In reply to: MAL: "Re: Using sed or awk to remove #'s from commented lines."
- Next in thread: Chuck Geigner: "Re: Using sed or awk to remove #'s from commented lines."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|