2 Şubat 2016 Salı

Konfig dosyalarını yorum kısımlarını atarak okuma


Grep komutuyla başlıkta da belirttiğim olayı kolaylıkla yapabiliriz.
Başında # olan satırları veya boş satırları ignore etmek için ;


$ grep ^[^#] snmpd.conf 

Komutunu kullanabiliriz.


Ayrıca ,

$ grep ^[^#] snmpd.conf  > yeni.conf 

komutunu çalıştırarak çıktıyı yeni bir dosyaya da yazabilirsiniz


Bu komutu kolaylık olması açısından aliaslar arasına ekleyebiliriz de,


[huseyin@server1 ~]# alias temizconf='grep ^[^#]'
[huseyin@server1 ~]# 
[huseyin@server1 ~]# temizconf /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
[huseyin@server1 ~]#



Hiç yorum yok:

Yorum Gönder