Page 1 of 1 1
Topic Options
#60310 - 2001-11-05 11:16 PM Is Kixtart fast enough?
Anonymous
Unregistered


Hi!

Kixtart is the best script languange so far and I simply like it.. althought I am not such expert as some of you are (I like asembler) I was wondering...
Does Kixtart have something like separator (like awk).
Example: I have a csv file and I want to jump on 3rd value in this file without the need to proces every value in order to compare it to comma.

More concrete: I want to process a dump of event viewer log files..

btw sorry for my english

P.S. Is Kixtart fast enought to do this in realtime?

Top
#60311 - 2001-11-05 11:29 PM Re: Is Kixtart fast enough?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey Gambler, feel lucky today ?

If your betting on using KiXtart 2001 (RC3) - you can use the new SPLIT() function to automatically parse-out a string into array elements ... this example reads a CSV file and displays the third comma-delimited field :


code:

break on


$logfile = "D:\TEST.DAT" <-- change this


if open(1,$logfile,2) = 0
$line = readline(1)
while @error = 0
$array = split($line,",")
?"Third element = " $array[2]
$line = readline(1)
loop
$ = close(1)
endif


exit 1



Carefull - the SPLIT function will have you rolling snake-eyes if your CSV file contains unexpected lines - might have to make this code more robust ...

-Shawn

Top
#60312 - 2001-11-05 11:55 PM Re: Is Kixtart fast enough?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
first check the size of the split array by using the UBOUND() command, that would prevent you from trying to pull an nonexistent array field.

code:

break on

$logfile = "D:\TEST.DAT" <-- change this

if open(1,$logfile,2) = 0
$line = readline(1)
while @error = 0
$array = split($line,",")
if ubound($array) < 2
;don't pull the array info! kix will crash!
else
?"Third element = " $array[2]
endif
$line = readline(1)
loop
$ = close(1)
endif

exit 1



Top
#60313 - 2001-11-06 03:21 AM Re: Is Kixtart fast enough?
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Welcome to the board.

The new release with the split function makes your life very easy,
but reading information from a file isn't very fast. be aware of that.
The kixtart 4.00 release is must faster then previous releases.
greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#60314 - 2001-11-06 05:12 PM Re: Is Kixtart fast enough?
Anonymous
Unregistered


Thank you very much you are very polite.

You are GREAT!

Thank you once more..

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.05 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org