code: def replace_in_files(search, replace, depth=0, paths=None, confirm=True):
      
  
      # have the user select some files
      if paths==None:
          paths = _s.dialogs.MultipleFiles('DIS AND DAT|*.*')
      if paths == []: return
  
      for path in paths:
          lines = read_lines(path)
  
          if depth: N=min(len(lines),depth)
          else:     N=len(lines)
  
          for n in range(0,N):
              if lines[n].find(search) >= 0:
                  lines[n] = lines[n].replace(search,replace)
                  print(path.split(_os.path.pathsep)[-1]+ ': "'+lines[n]+'"')
  
          # only write if we're not confirming
          if not confirm:
              _os.rename(path, path+".backup")
              write_to_file(path, join(lines, ''))
  
      if confirm:
          if input("yes? ")=="yes":
              replace_in_files(search,replace,depth,paths,False)
  
      return
docs: Does a line-by-line search and replace, but only up to the "depth" line.