Re: Using sed or awk to remove #'s from commented lines.
From: Ed Morton (morton_at_lucent.com)
Date: 06/02/03
- Previous message: stephan beal: "Re: Using sed or awk to remove #'s from commented lines."
- In reply to: Jim: "Using sed or awk to remove #'s from commented lines."
- Next in thread: MAL: "Re: Using sed or awk to remove #'s from commented lines."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 02 Jun 2003 11:06:23 -0500
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?
>
> I figured that this should be pretty straight forward using sed, so I
> tried the following:
>
> sed '/^# ftp/s/#/ /g' /etc/inetd.conf
That should work just fine, though you don't need the "g" (for "globally" at the
end) and you could just do /#// instead of replacing the # with a space. Are you
sure there's just one space char (not multiple or tab) between the # and "ftp"
and that the "#" is at the start of the line? What output do you get?
Ed.
- Previous message: stephan beal: "Re: Using sed or awk to remove #'s from commented lines."
- In reply to: Jim: "Using sed or awk to remove #'s from commented lines."
- Next in thread: MAL: "Re: Using sed or awk to remove #'s from commented lines."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|