Split a text file and save it into paragraphs in other text files Topic is solved
Split a text file and save it into paragraphs in other text files
I need a script that can split text from a text file into other text files for each paragraph. Each paragraph should be saved as a text file
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Split a text file and save it into paragraphs in other text files
one method
Code: Select all
test =
(
I need a script that can split text from
a text file into other text files for
each paragraph. Each paragraph should
be saved as a text file
Is it by any way possible?
Even to avoid script
error after same 2nd key use
I need can split text from
)
array := strsplit(test, "`n`n")
loop, % array.maxIndex()
MsgBox, % array[A_Index] ; you could replace with FileAppend, % array[A_Index], % "file" a_index ".txt"
ExitApp
Re: Split a text file and save it into paragraphs in other text files
I suggest the following change to handle files that have both CR+LF (`r`n) characters between each line instead of just a LF (`n) character:
Code: Select all
array := strsplit(strreplace(test, "`r"), "`n`n")
Re: Split a text file and save it into paragraphs in other text files
this is good but i need it to read from a text file and save as text files
Re: Split a text file and save it into paragraphs in other text files Topic is solved
from 'AHKStudent' and 'boiler'
( AHKStudent used the variable 'test' for quick testing )
( AHKStudent used the variable 'test' for quick testing )
Code: Select all
f1=%a_scriptdir%\hh.txt ;--- <<< here is the text
fileread,aa,%f1%
array := strsplit(strreplace(aa, "`r"), "`n`n")
loop, % array.maxIndex()
FileAppend, % array[A_Index], % "file" a_index ".txt" ;-- write to file in a_scriptdir\file1.txt ... \file2.txt ... etc
ExitApp
Who is online
Users browsing this forum: balawi28 and 250 guests