RE: [SLUG] Apache is driving me nuts

From: Eben King (eben1@tampabay.rr.com)
Date: Wed Dec 07 2005 - 14:53:06 EST


On Wed, 7 Dec 2005, Ben Ostrowsky wrote:

> OK, I'm using this command:
>
> grep -v '^[[:blank:]]#' /etc/httpd/conf/httpd.conf | sed
> 's/^\(.*\)[[:blank:]]*#.*$/\1/' | grep -v ^$

Shouldn't there be an asterisk after the second close bracket in the first
grep command?

> And that seems to be almost what I want -- now is there a way to re-tab it
> to show nested stuff, like this?
>
> Input:
>
> <VirtualHost>
> <Directory>
> </Directory>
> </VirtualHost>
>
> Output:
>
> <VirtualHost>
> <Directory>
> </Directory>
> </VirtualHost>
>
> Ben

Jeez, that sounds hard. Look for "pretty-printing" (pseudo-HTML variant) on
the web (or maybe with "man -k"). I guess you could do it programmatically,
where you maintain a counter "indentLevel" (initialized to 0), and at each
"<" you increment it, and at each "</" you decrement it. Then each
time you print a line, print indentLevel*indentString+text+NL.Don't think I
can put that into a pipeline.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
SAGITTARIUS:  All your friends are laughing behind your back... kill
them.  Take down all those naked pictures of Ernest Borgnine you've got
hanging in your den.  -- Weird Al, _Your Horoscope for Today_

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:18:06 EDT