How to use KDB as a command line?

Hi all,Sorry I am really a newbie. I spent a lot time on the followingproblem and couldn’t find a solution. Could you please help me?I have a csv file, which contains the tick data with the followingformat:timestamps, bp, bs, ap, as, tp, ts-----------------------------------------------------20101014 09:00:0020101014 09:05:00Of course these are event data but I would like to convert them intosnapshot data. That’s to say, I would like to find the "outstanding"bp, ap, and tp at certain time as a snapshot. For example, if there isno activity between 09:00:00 and 09:05:00, then if I query the statusat 09:05:00 as a snapshot, I should get the ap, bp and tp at09:00:00.I would like to create such a function with the date/time as input andthe “outstanding” quotes/prices as outputs..How to do that?And is there a way to use KDB as a command line: i.e. by executing:q MyFunc.q MyFile.csv 20101014 09:05:00 > MyOutputs.csv------------------------------------How to do the above in q/KDB?Thanks a lot!

aj
? Attila