Dear Monks
I have a big text file (200 MB) with the following structure: it has 100 reviews, each review with 5 formulas, and each formula (f) iterate 19200 times according with the values I passed, which will the same for review 2 and so on.
Review 1
f: 1 total: 30 values: 50: 20: 0: 0 ...
f: 1 total: 30 values: 50: 25: 4: 4 ...
f: 1 total: 30 values: 55: 45: 8: 6 ...
... (19200 f1 total for review 1)
f: 4 total: 250 values: 50: 20: 0: 0 ...
f: 4 total: 320 values: 50: 25: 4: 4 ...
f: 4 total: 330 values: 55: 45: 8: 6 ...
... (19200 f4 total for review 1)
Review 2
f: 1 total: 20 values: 50: 20: 0: 0 ...
f: 1 total: 30 values: 50: 25: 4: 4 ...
f: 1 total: 45 values: 55: 45: 8: 6 ...
... ... (19200 f1 total for review 2)
f: 3 total: 250 values: 50: 20: 0: 0 ...
f: 3 total: 320 values: 50: 25: 4: 4 ...
f: 3 total: 330 values: 55: 45: 8: 6 ...
...... (19200 f3 total for review 2)
My questions is how can I split the file in 19200 text files in one directory, each file with the same 100 reviews, and 5 formulas but each file refering a specific values used in the formula (f)
Example = File00001.txt: with the formula using values 50:20:0:0
Review 1
f:1 total: 30 values: 50: 20: 0: 0 ...
f:2 ...
f:4 total: 250 values: 50: 20: 0: 0 ...
Review 2
f:1 total: 20 values: 50: 20: 0: 0 ...
f:2 ...
f:3 total: 250 values: 50: 20: 0: 0 ...
File00201.txt:
Review 1
f:1 total: 30 values: 50: 25: 4: 4 ...
f:2 ...
f:4 total: 320 values: 50: 25: 4: 4 ...
Review 2
f:1 total: 30 values: 50: 25: 4: 4 ...
f:2 ...
f:3 total: 320 values: 50: 25: 4: 4 ...
f:4 ...
File00301.txt:
Review 1
f: 1 total: 30 values: 55: 45: 8: 6 ...
f: 4 total: 330 values: 55: 45: 8: 6 ...
Review 2
f: 1 total: 45 values: 55: 45: 8: 6 ...
f: 3 total: 330 values: 55: 45: 8: 6 ...
Using a regular expression will be enough?, Should I delete the blank spaces and iterate 19200 + including titles, and split?
Thank you in advance for your help
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.