Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Split files into chunks of $n lines

by kirbyk (Friar)
on Sep 27, 2005 at 15:56 UTC ( [id://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

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. :)

        --k.


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found