title: multiple rows in python script
body: <p>this is my python code below :</p>
  
  <pre><code>import glob
  lines = []
  
  for filename in glob.glob('*.sql'):
      with open (filename, 'rt') as in_file:
  
          for line in in_file:
              lines.append(line)
  
      #for element in lines:
      #   print(element) 
  
  
  enumerate(lines)
  #print(list(enumerate(lines)))
  
  #for linenum, line in enumerate(lines):
  #   print(linenum, line)
  
  
  
  substr = "NO FALLBACK" # Substring to search for, in this case a single character 
  for linenum, line in enumerate(lines): 
      index = 0 
      str = lines[linenum] 
      while index &lt; len(str):
          index = str.find(substr, index) 
          if index == -1:
              break 
          print("FileName:",filename, "Line: ", linenum, "Index: ", index) 
          index += len(substr)
  </code></pre>
  
  <p>HOWEVER, </p>
  
  <p>my output isn't coming correct. </p>
  
  <p>i have two files. 
  f1.sql and f2.sql are in the directory. 
  files are being read. 
  but the desired output isn't coming.</p>
  
  <p>i want if the word NO FALLBACK is written in the file then that file name, line Number and index should come. </p>
  
  <p>but my code keeps iterating over the number of lines in the file. </p>
  
  <p>below is the output coming: </p>
  
  <pre><code>('FileName:', 'f1.sql', 'Line: ', 4, 'Index: ', 71)
  ('FileName:', 'f1.sql', 'Line: ', 5, 'Index: ', 47)
  </code></pre>
  
  <p>the file name is same . this is wrong. and the line number is addition to the last line number, which is wrong again. </p>
  
  <p><strong>f1.sql</strong></p>
  
  <pre><code>-----------------------------------------------------------------------------  -----------------------
  ------------------------            Back Up Daily Fact          ------------------------
  ----------------------------------------------------------------------------------------------------
  
  CREATE MULTISET TABLE DP_SDM.NETWRK_OUTG_USG_DLY_SNAP_FCT_BKP20170203 ,NO FALLBACK ,
  </code></pre>
  
  <p><strong>f2.sql</strong></p>
  
  <pre><code>CREATE MULTISET TABLE dp_tmp_planning.nea_kqi ,NO FALLBACK ,
       NO BEFORE JOURNAL,
  </code></pre>