网络推荐



本广告位招租!

如何只查看配置文件中除了注释部分以外有用的内容?

配置文件大都有注释,而有些时候我们只希望看到那些需要修改的部分,不想看到注释,那么可以通过以下的方法来解决:
$ grep -v "^#" /path/to/config/file
$ grep -v "^#" /etc/apache2/apache2.conf

$ sed '/ *#/d; /^ *$/d' /path/to/file
$ sed '/ *#/d; /^ *$/d' /etc/apache2/apache2.conf
我也来说两句 查看全部回复

最新回复

  • wosl2001 (2008-6-12 18:48:39)

    dongxi bucuo  heh