Posts: 128
Threads: 48
Joined: Jan 2007
Hi there ...
could someone please help me again or direct me?
I have a bunch of textfiles, from which i want to extract all the same data... the data is contained in the files, and are digits of 23 numbers, the contain several lines and every line contains a 23 digit number which i want to extract...
Posts: 12,074
Threads: 141
Joined: Dec 2002
str s1 s2
s1.getfile("file")
foreach s2 s1
,out s2
Posts: 1,769
Threads: 410
Joined: Feb 2003
if you're looking to flip through a whole directory of files.
Macro
str strNum strAllNums strAllFiles
Dir d
ARRAY(str) aResult
foreach(d "c:\temp\*.txt" FE_Dir)
,str sPath=d.FileName(1)
,_s.getfile(sPath)
,strAllFiles.from(strAllFiles "[]" _s)
findrx(strAllFiles "[0-9]{23}" 0 4 aResult);;Note: This is Unicode safe. There are more than 10 numbers in Unicode.
for(_i 0 aResult.len)
,out "%s" aResult[0 _i]
Posts: 128
Threads: 48
Joined: Jan 2007
Thank you very much!
i appreciate this THX!
Posts: 128
Threads: 48
Joined: Jan 2007
And how to do this file by file... i mean if file a is processed the result is written to a_processed.txt and so on...
TIA
Posts: 1,769
Threads: 410
Joined: Feb 2003
what's happening in my code is pulling all the files into a varible and then it's searching that big variable and putting all the results into an array and then outputting that array into the output window. if you want to put it into another variable and then dump to a file, you can do that in the "out" portion of the array loop.
Posts: 128
Threads: 48
Joined: Jan 2007
Could you help me out, it sounds reasonable... but i'm not such a wizard as you are...
tia