The script splits the file into the required number of lines and saves it into a new file.
Python:
#~*~ coding: utf-8 ~*~
# Open file
src = open("links.txt", "r")
i = 0
line_i = 0
dest_str = "links_%s.txt"
# maximum lines count for each new file
max_lines_count = 1000
# read lines
lines = src.readlines()
src.close()
# open new file "links_0.txt"
f = open(dest_str % i, "w+")
# for each line
for line in lines:
# if lines count in new file is 1000
if line_i == max_lines_count:
# clise created file
f.close()
i += 1
# create new file
f = open(dest_str % i, "w+")
line_i = 0
print("creating file %s\n" % (dest_str % i))
# write line in file
f.write(line)
line_i += 1
f.close()