Answer» I would like to create a batch file that will: 1. Open a .TXT file 2. read the first LINE of the file and save that first line into a directory with a new file name. 3. read the next line of data and save to a new file. 4. The script should be able to sequentially name the new file (ie. newfile1.txt, newfile2.txt...newfileN.txt) as it moves to a new line.
The source file may have over 10,000 lines.
I have been able to accomplish this with a macro in Excel but I think it would run faster in DOS. Since I don't know DOS a little help with this will GET me started.Without an OS, any solution is only guesswork. Why would anyone would clutter their HARDDISK with over 10,000 files?
Code: [Select]echo off set count=0 for /f "tokens=1* delims=" %%i in (textfile.txt) do ( call :Output %%i ) echo %count% goto :EOF
:Output set /a count=%count%+1 echo %1 > newfile%count%.txt
If there are any DOS special CHARACTERS in the lines from the file, you may get unexpected results.
8-)
|