Please find below my code to split the file :
@Echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
Set /a xxFileNo=1
Set /a xxRecLimit=25
Set /a xxRecCount=0
Set /a cnt=0
Set “xxOutFile=D:\MyTextFileName_!xxFileNo!.txt”
Set “xxInFile=D:\MyTextFileName.txt”
for /f “tokens=* delims=^|” %%1 in (!xxInFile!) Do (
Echo %%1>>!xxOutFile!
Set /a xxRecCount+=1
set /a cnt+=1
if !cnt! gtr !xxRecLimit! (
Set /a xxFileNo+=1
Set “xxOutFile=D:\MyTextFileName_!xxFileNo!.txt”
Set “Header=”MyCustom Header Line”
Echo !Header!>>!xxOutFile!
Set /a xxRecCount-=1
Set /a cnt=1
)
)
This code misses few records while writing to the output file. For example i have 100 records, each file should have 25 records in them. But this code only writes 17 record lines to the fourth file.
Can anyone help me in this code. It is little urgent and your help is much appreciated.
now i got the actual reason for missing records. They are missing because of their length. For these lines i am getting input line is too long error. Can you guide me in reading these lines also.
thanks in advance