Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract from textfile...
#1
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...
#2
str s1 s2
s1.getfile("file")
foreach s2 s1
,out s2
#3
if you're looking to flip through a whole directory of files.

Macro
Code:
Copy      Help
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]
An old blog on QM coding and automation.

The Macro Hook
#4
Thank you very much!

i appreciate this THX!
#5
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
#6
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.
An old blog on QM coding and automation.

The Macro Hook
#7
Could you help me out, it sounds reasonable... but i'm not such a wizard as you are...

tia


Forum Jump:


Users browsing this thread: 5 Guest(s)