Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.





mcgint wrote:I think I need to learn PERL or Python.
# -*- coding: iso-8859-1 -*-
import os, glob
which_files="*.txt" # enter correct wildcard here
match_string="01" # string to match at pos. 12/13
def all_files():
for filename in glob.glob(os.path.join(".", which_files)):
yield filename
if __name__ == '__main__':
for filename in all_files():
print "Processing file", filename
file_in = open(filename, "r")
file_out = open(filename+".out", "w")
for line in file_in:
try:
if line[11:13]==match_string:
file_out.write(line)
except:
pass
file_in.close()
file_out.close()

# -*- coding: iso-8859-1 -*-
import os, glob
which_files="*.txt" # enter correct wildcard here
match_string=["01", "AB", "XY"] # string(s) to match at pos. 12/13
def all_files():
for filename in glob.glob(os.path.join(".", which_files)):
yield filename
if __name__ == '__main__':
for filename in all_files():
print "Processing file", filename
file_in = open(filename, "r")
all_output_files={}
for item in match_string:
all_output_files[item] = open(filename+item+".out", "w")
for line in file_in:
try:
if line[11:13] in match_string:
all_output_files[line[11:13]].write(line)
except:
print "This shouldn't happen."
file_in.close()
for item in match_string:
all_output_files[item].close()

# -*- coding: iso-8859-1 -*-
import os, glob
which_files="*.txt" # enter correct wildcard here
match_string=["01", "AB", "XY"] # string(s) to match at pos. 12/13
def all_files():
for filename in glob.glob(os.path.join(".", which_files)):
yield filename
if __name__ == '__main__':
all_output_files={}
for item in match_string:
all_output_files[item] = open("rectype"+item+".out", "w")
for filename in all_files():
print "Processing file", filename
# for item in match_string:
# all_output_files[item].write("------- Output from file "+filename+" starts here -------\n")
file_in = open(filename, "r")
for line in file_in:
try:
if line[11:13] in match_string:
all_output_files[line[11:13]].write(line)
except:
print "This shouldn't happen!"
file_in.close()
for item in match_string:
all_output_files[item].close()