I CAN NOT USE OPEN ON THE FILE! IT IS TOO LARGE TO OPEN IN MY OS

With respect, that doesn't make sense. For the file to exist on your system, something must have written to it, and therefore that same something must have opened it.

Likewise, for any shell utility to process it, even if only to split it, it has to open it.

So I can only resort to shell.

If you really need a shell solution, I would recommend asking on a site that specialises in shell - not Perlmonks.com?

However, I think the biggest problem here is your understanding of what open does and means. You can open a file without needing to read the whole thing into memory. You could for instance, open the file, read it in smallish chucks, counting the '>' chars and recording the positions of each as you went through. You would then know how many there are and where they are.

You then decide how to split the file, re-open it and open a split file, read the first chunk bit by bit and write it to the split file. Then close the first split file and open a second, continue reading and writing, opening and closing new files until you have the number of smaller files that you want.

You' have to make sure that you had sufficient disc space (at least double and possibly more) for this to work.

That would be a Perl solution. Maybe if you at least told us which OS you are using then someone might also suggest a more efficient method using a system utility, but you'd be better asking elsewhere for that kind of help.


Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

In reply to Re: get the line of ith occurrence of '>' without OPENING THE FILE by BrowserUk
in thread get the line of ith occurrence of '>' without OPENING THE FILE 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.