ajguitarmaniac has asked for the wisdom of the Perl Monks concerning the following question:
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!!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Text file manupulation to create test files
by ELISHEVA (Prior) on Jan 10, 2011 at 13:43 UTC | |
by ajguitarmaniac (Sexton) on Jan 10, 2011 at 15:10 UTC | |
Re: Text file manupulation to create test files
by Ratazong (Monsignor) on Jan 10, 2011 at 13:45 UTC | |
by ajguitarmaniac (Sexton) on Jan 10, 2011 at 14:09 UTC | |
Re: Text file manupulation to create test files
by ww (Archbishop) on Jan 10, 2011 at 13:45 UTC | |
by elef (Friar) on Jan 10, 2011 at 18:01 UTC |