LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-12-2014, 11:21 AM   #1
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Config file "cleaner"?


I have to administer Nagios once again. I was wondering if there was such a thing as a config cleaner that can go through a file, remove all the comments,.. and also standardize spacing and tabbing.

So this: http://fpaste.org/133185/41053870/

Would be cleaned up and look like this: http://fpaste.org/133190/41053880/

Is there a standardizer that can do this with minimal research and learning? I don't want to have to sit in a manual for the next two months to clean 4 files.
 
Old 09-12-2014, 11:50 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
cat /path/to/file/to/clean | grep -v "#" | sed '/^$/d' > new.file
may do it.
But "standardize" spacing? What's that?

Quote:
Originally Posted by szboardstretcher View Post
I don't want to have to sit in a manual for the next two months to clean 4 files.
ha!
How about throwing me a bone over at https://www.linuxquestions.org/quest...er-4175518374/?

Last edited by Habitual; 09-12-2014 at 11:54 AM.
 
Old 09-12-2014, 11:56 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Original Poster
Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
That almost works,. but doesn't take care of end of line comments, nor the standardized tabbing/spacing.

Sure.
 
Old 09-12-2014, 11:57 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
That almost works,. but doesn't take care of end of line comments, nor the standardized tabbing/spacing.

Sure.
Some more clever than I can help with that, I'm sure.
I'm not "that good".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 06:41 PM
".config" and ".kde" folders are being created under root directory (Slack Current) piratesmack Slackware 8 03-12-2011 11:06 PM
Why we should give "core" parameter in yum config file ram_rajavarapu Linux - Enterprise 2 08-16-2010 12:49 PM
[SOLVED] Why "apt-file search wx-config" not find? (Debian Lenny) kaz2100 Debian 4 01-02-2009 11:38 AM
Bios config: "ahci" or "standard ide" for a sata drive ? Danodare Slackware 1 11-05-2006 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration