I am trying to search and replace using two different files with strict search rules.
One file contain some data and the other file contain some numbers as shown below.
DataFile.txt
HTML Code:
>L1_T1
text data...
text data..
>L1_T1
text data...
text data..
>L1_T1
text data...
text data..
.....
.....
>L1_T2
text data...
text data..
>L1_T2
text data...
text data..
...
... upto
>L7_T8
text data...
text data..
>L7_T8
text data...
text data..
data header ranges from L1_T1 .. L1_T8 .. upto L7_T8 (56 headers altogether)
NumberFile.txt
HTML Code:
1
3
4
7
8
75
86
...
...
4025
4030
4032
I want to replace the headers(L*_T*) of DataFile using the numbers from the NumberFile. However, the condition is each header has a particular range to take the numbers and one number can't be used twice. For Example:
L1_T1 can take those available numbers within the range 1 - 72
L1_T2 can take those available numbers within the range 73 - 144
L1_T3 can take those available numbers within the range 144 - 216
....
L1_T8 can take those available numbers within the range 505 - 576
....
...
L7_T8 can take those available numbers within the range 3961 - 4032
(Increment of 72 for each increasing Header)
Example Output for the above data can be:
HTML Code:
>1
text data...
text data..
>3
text data...
text data..
>7
text data...
text data..
.....
.....
>75
text data...
text data..
>86
text data...
text data..
...
...
>4030
text data...
text data..
>4032
text data...
text data..
Thanks for any help.