Quote:
Originally Posted by
bioinfo
Hi,
Thanks again for guidance.
Sorry, I did not mean to hurt anyone.
Most of your assumptions are correct and I wish to make some of them more clear:
2. The values of x are not in a sequence, but surely positive. For e.g. 2000, 7000, 3000, 1982480 (for bigger files) etc.
3. For each each value of first field (x) from o.txt and dividing it by 100, I wish to retreive corresponding entry from 11.txt ending with ENDMDL. That means, if the value of x is 1000.000, then I wish to divide it by 100 and then retreiving 10th entry from 11.txt.
Please explain the concept of rc.
Thanks again.
The script I provided in message #8 in this thread assumes that the first field in o.txt has the values 7000.000, 3000.000, and 1982400.000 (not 1982480.000 or 1982480) to get the 70th, 30th, and the 19,824th entry from 11.txt. If the 1st field in o.txt does not end with 00.000, the current script won't print anything for that line in o.txt. If you have values like 1982480 which is not evenly divisible by 100, you need to explain if the value is to be skipped, truncated, or rounded to determine which entry from o.txt to print? (In other words since there is no entry numbered 19,824.80, do you want nothing to be printed, do you want the result of the division truncated to return the 19,824th entry, or do you want it rounded to return the 19,825th entry?) Why did all entries in you sample o.txt file end with 00.000 if you are saying that the values in the value are sometimes integers and that the values aren't evenly divisible by 100?
The script I provided does not assume that the values in the first field from o.txt are in sequence; with the data you gave as a sample it will print the 1st, 20th, and 10th entries from 11.txt in that order.
In the script I provided, rc is the number entries that have been read from 11.txt plus one. So when the script starts reading lines from 11.txt, the lines will be accumulated into r[1] until after the line containing ENDMDL is added to the entry. Then rc will be incremented so that subsequent lines will be added to the next entry...