Namaste Monks,

I'm looking to change the format of an existing input file that I'm using to a new one. I must admit that I am in a fix as to how to start. Let me explain the conditions here.

My current input file looks something like this.

Loop 1 Line 1- SBSB_ID = 123456789,First_name = "Ajay", Last name = "George", + WMDS_SEQ_NO1 = 2, WMDS_SEQ_NO2 = 3,WMDS_SEQ_NO3 = 5 Line 2- Line 3- Line 4- .... .... Line n Loop2 Line 1- SBSB_ID = 123456782,First_name = "Ryan", Last name = "George", + WMDS_SEQ_NO1 = 2, WMDS_SEQ_NO2 = 3,WMDS_SEQ_NO3 = 5 Line 2- Line 3- Line 4- .... .... Line n EOF

The contents of line 2 till Line n can be considered as irrevelant info for now. Line 1 till Line n is called a single "Subscriber loop".The entire file can have several such "Subscriber loops".

I'm looking to create test files in the new format. This has 2 steps to it. 1) A change to be done from on the existing format. According to the new format the file should look like this.

Loop 1 Line 1- SBSB_ID = 123456789,First_name = "Ajay", Last name = "George" Line 2- WMDS_SEQ_NO1 = 2 Line 3- WMDS_SEQ_NO2 = 3 Line 4- WMDS_SEQ_NO3 = 5 Line 5- Line 6- .... .... Line n Loop 2 Line 1- SBSB_ID = 123456782,First_name = "Ryan", Last name = "George" Line 2- WMDS_SEQ_NO1 = 2 Line 3- WMDS_SEQ_NO2 = 3 Line 4- WMDS_SEQ_NO3 = 5 Line 5- Line 6 .... .... Line n EOF

2) In the generated file,subscriber loops are to be duplicated in order to generate large files by changing the SBSB_ID alone. So if a input file has 2 subscriber loops, the output file must have, say 100 loops with different SBSB_ID.

Please guide me as to how I should go about this.I'm not asking for the code here, something like an algorithm would do. I'll start with the code and post further questions if difficulties are encountered. Thanks in advance!!


In reply to Text file manupulation to create test files by ajguitarmaniac

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.