After extracting your filter preferences, you start a first ("outer") loop where you go through the filters one by one.
Inside that loop you read the input file and check the filter condition for each line of the input file ("inner" loop).
BUT when you end the "inner" loop you have exhausted the input file and when you start the next iteration of your "outer" loop, <IN> will return nothing and your "inner" loop gets skipped.
I really doubt that is what you meant to do. Rather you should open the input file inside the outer loop and close it again after the "inner" loop is finished. The next iteration of the "outer" loop will then open the input file again and start reading it afresh and checking your next filter. Of course that is a slow and wasteful way of working: for every filter you walk the input file afresh. It is OK when the files are small, but it quickly will become unwieldly and slow when the files grow.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
|---|