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

From: Ed Morton (morton_at_lucent.com)
Date: 06/02/03

  • Next message: Ed Morton: "Re: Using sed or awk to remove #'s from commented lines."
    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.


  • Next message: Ed Morton: "Re: Using sed or awk to remove #'s from commented lines."

    Relevant Pages

    • Re: worm/virus impact
      ... Jim, thanks for the response. ... I've checked my settings in both OE and the file type ... The worm was executed, but it was run under a limited ...
      (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
    • Re: removed computer, add back, not on connectclient list
      ... Jim ... > and Settings (make sure you have the folder settings set to show all files ... So we removed the computer from the network ... We supply the sbs administrator account ...
      (microsoft.public.windows.server.sbs)
    • Re: WSUS did not recognize clients - Added Registry entries
      ... In the Group Policy Management console, I linked the policies to the correct ... > Jim G wrote: ... >>including creating the GPO settings. ... >>(SBS Workstations, SBS Notebooks, or SBS Servers). ...
      (microsoft.public.windows.server.sbs)
    • Re: attn dorayme and others who recognise the sig
      ... Jim S wrote: ... settings, it is something to do with byte order of saved files. ... It is like learning a foreign language without any intention of going ... As for the arrow colour, well I use several different coloured pages and I ...
      (alt.html)
    • Re: Finding What Cultural Environment An XLS Was Created In: Excel
      ... Jim is correct, but a possible solution would be to use formats that don't look ... at the regional settings. ... settings, and which are not. ... Settings, not excel, so there is no way to tell what the formatting on the ...
      (microsoft.public.excel.misc)