Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Not exactly new to Linux but - over the years I have been appalled to find hundreds of configuration files for every known program/service in Linux with millions of lines of useless comments that you have to endlessly scroll up-and-down in a text-editor to find anything of value and then make sense of what you need to configure/change, etc.
Is there an automated way to clean up any given configuration file and get rid of the "filler" stuff ??
Seems like a shell script should be able to accomplish the task by getting rid of all lines that start with # ..
Thanks.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Is this a troll?... because I'm tempted to bite.
You must be a pretty smart person to think that the comments someone took the time to write are merely obfuscating the information. I've always viewed the ability to heavily comment configuration files as beyond good, but crucial. Do you save wasted disk space by deleting the man pages, too?
Looks like I have bitten...
--- rod.
Hmmm, a better idea might be to pipe the output to 'less' rather than create a new file (although that doesn't seem to be what the OP was asking for). That way you have a transient version that gives a quick summary.
OTOH, I've just tried it on an arbitrary but unfamiliar conf file, and it renders the file virtually unreadable (incomprehensible). Virtually unreadable, though compact, so scrolling is quicker, although, arguably, I might like it better on a conf file that I knew well. Maybe. You pays your money and you takes your choice, I suppose.
your solution is here: http://www.debian-administration.org...guration_files
Actually what i love is how they hide comments in vim without actually removing them. So you get the best of both worlds:
compact view that lets you view only the active lines, but at any time you can get any comment back. And if you save the document, the comments are untouched.
I just tried this in gvim which adds mouse support to vim, vim itself extending vi.
You must be a pretty smart person to think that the comments someone took the time to write are merely obfuscating the information. I've always viewed the ability to heavily comment configuration files as beyond good, but crucial.
For me they are crucial when the configuration is unfamiliar but do prevent "seeing the wood for the trees" when it's familiar. I always keep the original (typically renamed with a .org suffix) and, for heavily commented files, strip the comments. A benefit of this scheme is that searching for *.org files (and directories in the case of directories in which every file is used to configure) identifies all the configurations which have been customised since installation.
With today's hdd density I cannot see the reasoning behind removal of text comments within configure files.
Even before the higher disk density I would not remove comment text from configure files. Too many, plus there is no way that you could remember the conditions for all files. I have files that were written years ago and thankfully comments were there to refresh my memories.
With today's hdd density I cannot see the reasoning behind removal of text comments within configure files.
Even before the higher disk density I would not remove comment text from configure files.
The reason the OP wanted to remove comments is not because of HDD space, but because they're hard to scroll through in an editor.
I personally am a great fan of commented config-files. Since it is so easy to strip out the comments, or fold them in vim, I see no reason to get rid of the comments in standard configuration files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.