Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Split string after 14 Line Feeds?

by johngg (Abbot)
on Dec 03, 2012 at 23:47 UTC ( #1006966=note: print w/ replies, xml ) Need Help??


in reply to Split string after 14 Line Feeds?

Another way would be to accumulate the chunks as you read the file.

$ for i in `seq 1 13`; do echo Line $i; done | perl -e ' while ( not eof STDIN ) { my $buf; $buf .= $_ for map { eof STDIN ? () : scalar <> } 1 .. 5; print $buf; print q{+} x 10, qq{\n}; }' Line 1 Line 2 Line 3 Line 4 Line 5 ++++++++++ Line 6 Line 7 Line 8 Line 9 Line 10 ++++++++++ Line 11 Line 12 Line 13 ++++++++++ $

I hope this is of interest.

Cheers,

JohnGG


Comment on Re: Split string after 14 Line Feeds?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-07-29 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls