Front page | perl.golf |
Postings from June 2009
Re: Another one-liner?
Thread Previous
|
Thread Next
From:
Daniel Tiefnig
Date:
June 24, 2009 08:05
Subject:
Re: Another one-liner?
Message ID:
4A424097.5050705@gmx.at
Phil Carmody wrote:
> I needed to remove blank-line-separated chunks of code from a text
> file if those chunks contained any lines which were 'too long'.
[...]
> If you think how little it does, it's got to be one-linerable, no?
Duh, wrong e-mail address, sorry if solutions show up twice now after a
while...
Should do the trick if paragraphs are separated by *empty* lines:
perl -00 -ne'/.{65535}/||print'
Here's one that does split on lines with whitespace too, but is much
less elegant than my first one:
perl -0777 -F'(?<=\n)\s*(?=\n)' -ane'/.{65535}/||print for@F'
Maybe one can save one or the other stroke with a smarter solution of
the newline issue...
lg,
daniel
Thread Previous
|
Thread Next