Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Split files into chunks of $n lines

by kirbyk (Friar)
on Sep 27, 2005 at 15:56 UTC ( #495425=note: print w/replies, xml ) Need Help??

in reply to Split files into chunks of $n lines

If you're in unix, use the 'split' command. I think the syntax would be 'split -l 4000 filename', and it will do exactly what you want. (See man split for more detail.)

It's not tremendously hard to do it through perl, and if you want to modify anything that'd be useful. I'm sure someone will post code for that very soon. There's more than one way to do it!

-- Kirby,

  • Comment on Re: Split files into chunks of $n lines

Replies are listed 'Best First'.
Re^2: Split files into chunks of $n lines
by Kanji (Parson) on Sep 27, 2005 at 17:18 UTC

    Even if you don't use Unix (or do but are missing the split command), you can download a pure-Perl implementation of split from the Perl Power Tools site. :)


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-07-23 21:16 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (347 votes). Check out past polls.