How to divide a list evenly.
Posted: 05 Nov 2008 18:49
Hi folks,
Searched for "split", "divide", "separate" and couldn't find anything close to what i need. I'm new to the DOS environment and have only written some minor scripts at work. I've found a ton of small apps that can do what i want, but I work for a gov place, and they don't allow anything to be downloaded or installed if its not fed/state approved.
What i basically need is to split a list of hostnames evenly across 2 or 4 separate files.
So, for example, here's the main list(its in the 100's right now, and growing):
mainlist.txt:
test1server
test2server
test3server
test4server
test5server
test6server
test7server
test8server
test9server
test10server
test11server
test12server
== i like to split it up evenly across the board, best that we can, into 2 or 4 files...for example:
list1.txt:
test1server
test2server
test3server
list2.txt:
test4server
test5server
test6server
list3.txt:
test7server
test8server
test9server
list4.txt:
test10server
test11server
test12server
== I've looked at the "for /f" function...but didn't have the skills to figure it out, so glad i found this place.
Thanks in advance, hope yall can help.
Searched for "split", "divide", "separate" and couldn't find anything close to what i need. I'm new to the DOS environment and have only written some minor scripts at work. I've found a ton of small apps that can do what i want, but I work for a gov place, and they don't allow anything to be downloaded or installed if its not fed/state approved.
What i basically need is to split a list of hostnames evenly across 2 or 4 separate files.
So, for example, here's the main list(its in the 100's right now, and growing):
mainlist.txt:
test1server
test2server
test3server
test4server
test5server
test6server
test7server
test8server
test9server
test10server
test11server
test12server
== i like to split it up evenly across the board, best that we can, into 2 or 4 files...for example:
list1.txt:
test1server
test2server
test3server
list2.txt:
test4server
test5server
test6server
list3.txt:
test7server
test8server
test9server
list4.txt:
test10server
test11server
test12server
== I've looked at the "for /f" function...but didn't have the skills to figure it out, so glad i found this place.
Thanks in advance, hope yall can help.