#160154 - 2006-03-31 10:13 PM
Re: Text Extraction from a string
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
Quote:
"no problem." Thanks!
....W.W....
Yeah, what's 10 minutes - now had it stretched out to 15 then we might need to get our money back.
|
|
Top
|
|
|
|
#160161 - 2006-04-01 01:49 AM
Re: Text Extraction from a string
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
If the files are small enough, you can use the ReadFile() UDF but for big files you will want to code your own loop.
Code:
Break On $RC = SetOption('WrapAtEOL','On') $Folder = '\\ffpadcm01\c$\WINNT\system32\msplogs\' $LogFile = 'WS060327.log' $RC = Open(1,$Folder + $LogFile,2) $Line = ReadLine(1) $PrevLine = $Line $PrevLineArray = Split($PrevLine,',')
While @Error = 0 $LineArray = Split($Line,',') If $LineArray[11] = ' 443' And $PrevLineArray[10] = ' -' And $LineArray[1] = $PrevLineArray[1] $String = 'User ' + PadStr($LineArray[1],' ',10,'R') + ' Accessed ' + $PrevLineArray[9] $String ? EndIf $PrevLine = $Line $PrevLineArray = Split($PrevLine,',') $Line = ReadLine(1) Loop $RC = Close(1)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
|
Top
|
|
|
|
#160162 - 2006-04-01 02:51 AM
Re: Text Extraction from a string
|
StarwarsKid
Seasoned Scripter
   
Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
|
Breakthrough BLISS!! I love this.
I was able to craft a script that extracts the email addresses from an xch5.5 export. Beats the heck out of trying to do this manually for hundreds of users. Thanks for the guidance Les, you are a gem today!
Code:
Break On $SO = SetOption('NoMacrosInStrings','On') $array = ReadFile('e:\kixtest\xchport.txt')
for each $element in $array if left($element,5) = "SMTP:" $EMailAddy = Split(Split($element,'%')[0],':')[1] $RC=RedirectOutput("e:\kixtest\emailady.txt") IF RedirectOutput("e:\kixtest\emailady.txt") = 0 $EMailAddy ? endif else if left($element,7) = "CCMAIL:" $EMailAddy = Split(Split($element,'%')[2],':')[1] $EMailAddy ? endif
_________________________
let the wise listen and add to their learning, and let the discerning get guidance- Proverbs 1:5
|
|
Top
|
|
|
|
#160167 - 2006-04-03 07:16 PM
Re: Text Extraction from a string
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11629
Loc: CA
|
Code:
Break On $SO = SetOption('NoMacrosInStrings','On') $array = ReadFile('e:\kixtest\xchport.txt')
for each $element in $array if left($element,5) = "SMTP:" $EMailAddy = Split(Split($element,'%')[0],':')[1] $RC=RedirectOutput("e:\kixtest\emailady.txt") IF RedirectOutput("e:\kixtest\emailady.txt") = 0 $EMailAddy ? endif else if left($element,7) = "CCMAIL:" $EMailAddy = Split(Split($element,'%')[2],':')[1] $EMailAddy ? endif EndIf Next
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2419 anonymous users online.
|
|
|