How do I pipe the output of a unix command to a Julia script?

2016-05-13T04:54:58

I'm trying to utilize the STDIN construct with Julia to read in the output of a unix command:

#!/usr/bin/julia
readline(STDIN)

Then in my terminal:

$ cat myfile.txt | ./pipe.jl

but I am not getting any output. What am I doing wrong?

Copyright License:
Author:「dopatraman」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/37197237/how-do-i-pipe-the-output-of-a-unix-command-to-a-julia-script

About “How do I pipe the output of a unix command to a Julia script?” questions

I'm trying to utilize the STDIN construct with Julia to read in the output of a unix command: #!/usr/bin/julia readline(STDIN) Then in my terminal: $ cat myfile.txt | ./pipe.jl but I am not get...
I am trying the following out to create an instance of Julia within a bash script, run a julia script and then redirect all the output to submission.log: mkfifo pipe sleep 1000000 > pipe & ...
How do I run a system command and capture the output with Julia? In R I could do this with something like system_output <- system2("ls","-l", stdout=TRUE, stderr=TRUE)
I'm trying to do something like this: Say there are 4 users logged into a UNIX machine, a, b, c, and d. Now, to get the groups these guys belong to, I have to type out : groups a b c d. What I am
I'm trying to redirect a local script to an external server and need to use the < command in the Julia run() command. I use |> for > in Julia, but |< does not work for <. My question is ho...
I can capture the output of a julia script in the shell with the > operator, for example: $ julia script.jl > output.txt However, it seems that the file is only written to after the julia scr...
How can I call an external command (as if I had typed it into the Windows command prompt or Unix shell) from within a Julia program? I know this is possible with other languages but I'm not sure ho...
Following this answer here I'm trying to use the 'script' command to unbuffer output for use with a pipe. But it's not working as I'd expect. I have the following file: $ cat test.txt first line ...
Right now I'm using another text file to store the result of one UNIX command and then using that file to run another command, like so: tr -d "[,|.]" < text > temporary.txt tr "[A-Z]" "[a-z]...
I have this C function that I am using to output any amount of integer that is input. /* This program will be called function.c */ #include <stdio.h> int main (void) { int num; wh...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.