Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Splitting a file based on matched conditions

by Laurent_R (Canon)
on Sep 19, 2017 at 14:07 UTC ( #1199676=note: print w/replies, xml ) Need Help??


in reply to Splitting a file based on matched conditions

Hi skumar_pm,

I think you could read the file line by line until you meet an End tag and push them in an array. When you reach an End tag, determine in which output file it needs to go, print the array to the proper file handle. Then, empty the array, and read again lines into the array until reaching another End tag, and so on.

With a file containing 100k-lines, it should not be a problem to store the lines of one section (a Start..End chunk) into an memory.

  • Comment on Re: Splitting a file based on matched conditions

Replies are listed 'Best First'.
Re^2: Splitting a file based on matched conditions
by skumar_pm (Initiate) on Sep 20, 2017 at 08:25 UTC
    Thanks for your suggestion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199676]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-10-23 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (281 votes). Check out past polls.

    Notices?