Re: blank lines as "^\s*$"
"Ruud H.G. van Tol" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On 07/07/2013 09:38, RAKESH wrote: > We could also do it making use of the -0 777 option of perl where > the whole file is slurped in, & then we proceed to > chop off the leading & trailing blank lines, like as if chopping the front/tails of a carrot. > > perl -0777wple 's/\A\s+//ms;s/\s+\z//ms' yourfile That has issues: - the 'ms' modifiers are superfluous - the starting whitespace of the first non-whitespace line is removed - the newline after the last non-whitespace line is removed -- Ruud