Re: Using sed or awk to remove #'s from commented lines.

From: Kevin Rodgers (ihs_4664_at_yahoo.com)
Date: 06/03/03


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:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>


Relevant Pages

  • Using sed or awk to remove #s from commented lines.
    ... I'm writing a simple shell script that scans some config files to make ... sure that certain settings are on or off. ... How can I use sed or awk to remove only the comment so that the ...
    (comp.unix.shell)
  • Re: Using sed or awk to remove #s from commented lines.
    ... > I'm writing a simple shell script that scans some config files to make ... > sure that certain settings are on or off. ... > How can I use sed or awk to remove only the comment so that the ...
    (comp.unix.shell)
  • Re: Shell extension to pre filter file double click action?
    ... need to worry about my current practice of writing to ... the default settings and apply only to the interactive user. ... the system stores the information under ... | writing directly to HKLM. ...
    (microsoft.public.vb.winapi)
  • Re: /usr/home vs /home
    ... locations for settings makes it easy to back them up. ... config files, but per deduction, they should be in ... It just isn't completely filled with the conf files - but you can override the globals there if you choose. ... XDM is an embarrassment:P It _should_ be run as a daemon from rc.conf, but you set it in /etc/tty, so no real surprise that its conf files are chaotic too... ...
    (freebsd-questions)
  • Re: app.config and user.config files
    ... a user of an application I have written would go hunt around with notepad ... values anyway - so it's not like I'm asking them to edit the registry ... It was this layer of protection provided by the Settings ... the fact that users get their own individual config files) to make it ...
    (microsoft.public.dotnet.framework)