On Thu, Aug 20, 2009 at 11:16 AM, David Gillies <[email protected]> wrote:

> Voytek Eymont wrote:
>
>> how can I output a config file with only the valid directives, but not all
>> the '#' commented lines ?
>>
>> # cat /etc/sysconfig/iptables-config
>>
>> # Load additional iptables modules (nat helpers)
>> #   Default: -none-
>> # Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'),
>> which
>> # are loaded after the firewall rules are applied. Options for the helpers
>> are
>> # stored in /etc/modules.conf.
>> IPTABLES_MODULES=""
>> ....
>>
>> so to get only
>> IPTABLES_MODULES=""
>> ...
>>
>>
>>
> I'm sure there's nicer ways but this works for me:
>
> grep -v \# /etc/sysconfig/iptables-config
>


I wouldn't recommend this - in case you have comments at the end of a line
you will remove them as well - or if a "#" is part of the actual
command/text, ie:

     IPTABLES_MODULES=""    # This is a comment
or even
     SECRET="ahash###"

Both of these would be removed from the output.

You need to specifiy the beginning of the line ie "^#"

Cheers,

-- 
Craig Ayliffe
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to