Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Comment Stripper script for unix

by hsinclai (Deacon)
on Jun 14, 2004 at 15:35 UTC ( [id://366580]=note: print w/replies, xml ) Need Help??


in reply to Re: Comment Stripper script for unix
in thread Comment Stripper script for unix

Hi Abigail,

Your program will strip she-bang lines unless such a line starts with whitespace.
Are you sure about that? The shebang line is not stripped, if it is the first line, which gets preserved and re-inserted back into the final output..
update- you're totally right about that, I screwed it up..

why do you think this is useful for system administration..

Because removing commented lines lets you get a quick view only of active lines - in a file that might have only a few active lines among several screens of commented lines, e.g. a stock squid.conf file..

Thanks for the feedback!

Replies are listed 'Best First'.
Re: Comment Stripper script for unix
by Abigail-II (Bishop) on Jun 14, 2004 at 17:22 UTC
    Because removing commented lines lets you get a quick view only of active lines - in a file that might have only a few active lines among several screens of commented lines, e.g. a stock squid.conf file..
    Well, a simple grep -v ^\# will do that. If an "active" line has a trailing comment, it doesn't matter. It also doesn't explain why you want to remove comments from a shell script.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://366580]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-20 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found