Just read from STDIN and write to STDOUT and this should work as in any other language. You may need to call `flush(STDOUT)` sometimes since output is buffered – depends on what kind of buffering you need.
On Fri, Mar 4, 2016 at 12:05 PM, Ben Ward <axolotlfan9...@gmail.com> wrote: > Hi, > > I'm wondering how easy it is to make a Julia script that can be part of a > shell pipeline `cat file > julia myscript.jl > output.txt`? > > When reading the documentation, I get the impression most io is designed > to be done all at once. I know how to loop over a file handle or stream, > and I think > STDOUT and STDIN are accessible from Julia, I'm just unsure about how to > make it act as one link in a longer shell pipe. > For example, if I were to loop using a stream of STDIN, waiting for a > piece of data from the output of previous step instead of just thinking > STDIN is finished or just waiting for all of it, > I'd like things to move through piecemeal and so on, like a node stream or > unix pipe does. Are there any good examples of people doing this? > > Until now I've just read in whole files or iterated over lines of files, > and analysed them. > > Thanks, > Ben. >