| Bill Allombert on Tue, 14 Oct 2003 18:13:34 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: write in a file |
On Tue, Oct 14, 2003 at 04:52:53PM +0200, Dirk Laurie wrote:
> Can one read in from a Pari-GP-written file one item at a time?
> For example, in a loop I use 'write(filename,x)'. It creates
> a lot of lines starting with 'x='.
>
> If I say 'read(filename)', the whole file is read, and all the
> values of x except the last are lost. I want to read one, do
> something to it, read another, etc.
Try a named fifo an a line filter:
sh1$ mkfifo fifo
sh1$ gp
? for(i=1,10,print(i,read("fifo"))
in another shell write your data to fifo closing the fifo between each
line. For example
sh2$ perl -ne 'system("echo '\''$_'\'' > fifo")' <data
It looks awkward but just use the power of unix.
Cheers,
Bill.