Hi, several ways you can do it, eg
- Loop through the source file line by line and create a new file when you hit the empty lines (slow and easy);
- Use Separate> and use the empty lines as delimiters and create the files (faster and half easy);
- Use RegEx> to extract each recipe and write to file (fastest? and slightly? difficult)
I am used to RegEx so am using that here, will take my spontaneous file with recipes (600,000 lines) and create the 50,000 files in around 1 minute. If you are interested I can post the Separate> version later.
Code: Select all
Let>SourceFile=C:\...\recipe.txt
Let>TargetPath=C:\yourpath...\
ReadFile>SourceFile,strFileContents
Let>tmp0=(?s)(?:\A|[^\s]).+?(?=(\r\n\s)|\Z)
RegEx>tmp0,strFileContents,0,m,nm,0
Let>WLN_NOCRLF=1
Let>ct=0
While>ct<nm
Add>ct,1
Let>file=%TargetPath%%ct%.txt
WriteLn>file,nWLNRes,m_%ct%
EndWhile
MDL>Ready