hello there, I have a big chunk of data in a file that has got 7 columns(0-7). I would need the first and the third column in some case and the first and the fifth column in other cases. I have no problem parsing the columns. But I need to write them into 24 files depending on the second column,which is from 1-24.


The actual file is something like this:
10234,1,34234,342,453,34535,3453,3464 12123,1,23432,4353,44645,45654,45645,657 2123345,2,35435,3453,454,56567,56756,567567 3234353,2,34534,4564,567567,56757,56575,24234 33453,3,45464,4564564,45645,645645,54564,56456
I would like to have the required columns of the first two lines in a file and the next two in a separate file and so on for the rest(max 24).
Is there a module to do this? If not how could we open multiple files to write? Is there any easy method to do this?Any suggestions or ideas would be very helpful. thanks in advance.
PS. The files are comma separated and quite big- running upto 5442187 lines in the main file.

In reply to to divide/split a file to small files. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.