Search:  
Gentoo Wiki

TIP_Strip_comments_when_posting_config_files

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Contents

Introduction

It happens very often that people have to post some configuration files in order to get help with a configuration-related problem. Since some configuration files are very long, and contain lots of comments, such posts are really hard to read for other people. So it is good practice to remove all unnecessary comments. This is easily done with one of the following commands:

Commands

sed

sed -e 's/#.*//;/^\s*$/d' <file_name>

grep

egrep -v '(^[ ]*#|^#|^$)' <file_name>

perl

/usr/bin/perl while(<>) { print unless /^(#.+|\s+)$/ );

See Also

Original Forum Post

Retrieved from "http://www.gentoo-wiki.info/TIP_Strip_comments_when_posting_config_files"

Last modified: Fri, 05 Sep 2008 23:10:00 +0000 Hits: 13,621