[TAG] 2cent tip

Ben Okopnik ben at linuxgazette.net
Sat Jun 7 02:23:13 MSD 2008


On Fri, Jun 06, 2008 at 10:03:52AM -0700, Thomas Bonham wrote:
> Ben Okopnik wrote:
> >
> > 1) What about indented comments? This script would miss them.
> >   
> This is one designed for configuration files like httpd.conf, snmpd.conf.

Why not make it as generally applicable as possible rather than
restricting it? If you're going to build a tool, make is as robust as
possible. You'll find that this is usually a matter of a tiny
incremental change - which is exactly what it is in this case.

> > 2) While you're at it, you might as well remove blank lines.
> >   
> I never thought of that part there.
> > 3) It creates a file ('original_name.free') instead of just fixing the
> > original file.
> >   
> This is how I want it to be because of the fact that a lot of the times 
> I just want to see what is active in the config file or if I just would 
> like to work with something that doesn't have all of that trash in the 
> file. If you want to use it after clean it off you will just have to 
> move it over your self.

In that case, you can always use the one-liner I cited without the '-i'
option. This will allow you to redirect the output to a file, or pipe it
to, say, 'less' so you can examine it.


-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *




More information about the TAG mailing list