. also, you want the 'm' modifier for the s/// operator, since the whole file is read into a scalar
Which is not true with -pe without an alternative line ending. The file is read line-by-line.
the original poster wanted to keep those lines
So you're doing the exact opposite. I'm sure that'll help. Sigh. How about:
which does what the original poster wants (If I understood correctly).perl -i -pe'$_ = "" unless /^--/ or !/\S/'
Update - This was meant to be a reply to the parent of the node I replied to. This node's parent didn't have the code indented in a way I recognised as being a quote, and I didn't view the message in its context when I replied. To everyone who cites: please use <blockquote>. I use <p><blockquote><em> quote </em></blockquote></p><p> answer </p>, and even have that in my signature for ease of use.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
In reply to Re: Re: Re: simple (in theory) regexp question
by Juerd
in thread simple (in theory) regexp question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |