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

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, WhitePages.com


Comment on Re: Split files into chunks of $n lines
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. :)

        --k.


Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2014-08-28 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls