On Sun, Apr 13, 2008 at 09:16:59AM +1000, Alex Samad wrote: > On Sun, Apr 13, 2008 at 08:39:17AM +1000, Alex Samad wrote: > > Hi > > > > > > I want to look at a config file that uses ; as comments, but I want to > > look at everything that is not a commented line > > > > so I tried grep -v '^\W*;' which sort of works, except it leaves me with > > blank lines now, how can I not show the blank lines > > > adding to this I tried it in perl > > perl -nle 'print "[$_]" if ( ! m/^\s*;/)' sip.conf > > but it still prints out blank lines where it matches ?
more delving into it I need something like this perl -nle 'next if ( /^\s*;/); print if length $_ > 0' sip.conf I have to check if I have a blank line. I would have thought the next would read the next line ! > > > (i realised i used \W instead of \s before) > > another question while we are on regex, how do I use [:space:] in grep > and perl ? > > Alex > -- "Well, that's going to be up to the pundits and the people to make up their mind. I'll tell you what is a president for him, for example, talking about my record in the state of Texas. I mean, he's willing to say anything in order to convince people that I haven't had a good record in Texas." - George W. Bush 09/20/2000 on MSNBC
signature.asc
Description: Digital signature
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html