Why this doesn't work.
I am trying to edit a file that is using "Unix (LF)" but Loop,Parse displays nothing
FileRead and FileReadLine can output the line\text to a variable but Loop,Parse don't display anything no matter what delimiter I use
A_LoopField is always empty
Loop parse on Unix (LF) file? Topic is solved
Re: Loop parse on Unix (LF) file?
Code: Select all
;FileRead, file, unixfile.txt
;example unix text file
file =
(
One
Two
Three
Four
)
;example windows text file
;file := "One`r`nTwo`r`nThree`r`nFour"
;choose any
num := "Two"
;check what linefeed is used and assign to lf
lf := (inStr(file, "`r`n")) ? ("`r`n")
: (inStr(file, "`n")) ? ("`n")
: (inStr(file, "`r")) ? ("`r") : ("")
;get total lines
totalLines := StrSplit(file, lf).MaxIndex()
;do the loop with the delimeter from above operation
Loop, Parse, file, %lf%
{
if (A_LoopField == num)
msgBox % "A_LoopField is:`n" . A_LoopField
. "`n`nParsing worked, found correct line"
if (A_Index == totalLines){
msgBox % "Failed"
break
}
}
Re: Loop parse on Unix (LF) file? Topic is solved
Ok what happen,yesterday no matter what I tried,using Loop Parse was always displaying nothing
Today I tried it again and it magically started to work
Thanks anyway
Today I tried it again and it magically started to work
![Question :?:](./images/smilies/icon_question.gif)
Thanks anyway
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 330 guests