If the file only gets bigger, you could keep track of where the end of it
is and read everything from that point each time it gets bigger - something
like this:

   ts=. 1{"1 dir flnm
   lastpos=. fsize flnm
...
   while. ts-:ts2=. 1{"1 dir 'flnm' do. wait 1 end.
   new=. frdix flnm;lastpos,(newpos=. fsize flnm)-lastpos
   lastpos=. newpos [ ts=. ts2

(where "frdix" is "1!:11")

Not exactly real-time but with up to a one second lag because of the wait.
Is the problem that you need to get a signal when the file changes?

On Sun, Dec 18, 2011 at 11:13 AM, <elmer_...@antelecom.net> wrote:

> I need to process a file with the following structure.
>
> 10:14:44,0.3540,-0.0290,134988,-7.57,0.3610,0.3420,0.3343,0.3830
> ,0.3500,0.3710
> 10:16:44,0.3540,-0.0290,134988,-7.57,0.3610,0.3420,0.3343,0.3830
> ,0.3500,0.3710
> 10:22:45,0.3540,-0.0290,134988,-7.57,0.3610,0.3420,0.3343,0.3830
> ,0.3500,0.3700
>
> Every minute, if the detailed quote changes, a new row
> detailed quote information
> is appended to the file.  In this case the data is for a
> stock UURAF.
>
> The data is collected by using a bash script containing awk
> routines.
>
> I want to process the information in real time.  As an
> example, I would like to
> calculate the moving average for the last 5 and last 10
> trades.
>
> My first guess would be to initialize an empty array and as
> new data comes in insert
> it into the array.  When the array changes, I would
> recalculate and display the result.
>
> My question is:
>
> How do I add data in real time (when I get new data appended
> to my comma
> file ) to a J array that I can process?
>
> thanks
>
>
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to