Help for grep and array
Posted: 20 Mar 2018, 19:50
Hello,
I want to do a grep and paste result into a .txt with both result from "g" and "g2" and so on. Please see below code and let me know what to enter in the "for i, v in g" section
Thanks!
I want to do a grep and paste result into a .txt with both result from "g" and "g2" and so on. Please see below code and let me know what to enter in the "for i, v in g" section
Thanks!
Code: Select all
g:=grep(fileread2, "sU)id=""(.*)""")
g2:=grep(fileread2, "sU)No=""(.*)""")
countx := g.MaxIndex()
countx2 := g2.MaxIndex()
for i, v in g ;Here I want to fileappend the first result found of "g" and "g2" and paste it into the "OrderID.txt". I know it is not good but it show what I want to do.
{
result1 := v.1
for i, w in g2
{
result2 := w.1
}
fileappend, %result1% %result2% `n, OrderID.txt
}
grep(haystack, needle)
{
a:=[], match := "", pos := 1
while pos:=RegExMatch(haystack, needle, match, pos+StrLen(match))
a[A_Index]:= {"match": match, 1: match1}
Return a
}