Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
or example: consider the contents of file1.txt:
1   0   9227    1152    34  2
2   111 7622    1120    34  2
3   68486   710 1024    14  2
6   265065  3389    800 22  2
7   393152  48438   64  132 3
8   412251  46744   64  132 3
9   430593  50866   256 95  4
10  430730  10770   256 95  4
11  433750  12701   256 14  3
12  437926  2794    64  34  2
13  440070  43  32  96  3
14  440102  44  32  96  3
15  440357  43  32  96  3
16  440545  43  32  96  3
17  440599  43  32  96  3
18  440625  43  32  96  3
19  440999  84  32  96  0
20  441574  44  32  96  3

which the contains n jobs with 6 fields(i,e column(0-5))

Now, for example, I take the first 19 jobs as history. Then I need to start reading from the 20th and so on comparing the columns 3,4,5 which matches with the above jobs in the history.For the first recent occurrence i,e 18 440625 43 32 96 3.I need to check the condition if col1 of the 20th job is greater than the (col1 * 1.1) of the first recent occurrence i,e 18th if true it add the col2 to a list and should read the next recent occurrence i,e 17th job and so on until the if condition fails.Then need to add the 20th line to history making the history count of 21 there by updating the history and so on till the end of the file is reached......... Can any one suggest a code in python by which its possible for me to read the 20st line and compare with the above history and update it such that as continue to 21,22,23------------------ until the end of the file is reached.The history also gets updated and a lists of col2 that matches the if condition is generated??
Posted
Updated 13-Aug-13 20:24pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900