Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 chanting in the Monastery: (8)
As of 2014-09-02 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (31 votes), past polls