pipe

Ways to prevent broken pipe?

ClientAbortException: java.net.SocketException: Broken pipe If I am wright, this happens when user aborts current operation or makes another request, before the last one is finished. Can this reflects on browsing user or is this (always) just a Catalinas exception? Are there any ways to avoid this exception? ...

Subprocess Popen and PIPE in Python

The following code prints an empty line as an output which is false. The problem is not in the permissions, since I tested the command with 777 permissions for the pdf -file. How can you fix the command to give a right output? import subprocess from subprocess import PIPE, Popen output = Popen(['pdftotext', '/home/aal/Desktop/lkn_pdf/ap...

Windows Shell: Pipe to a script...

Dear Experts, I'm writing a script that should process a contents of a file, but should be file-independent. The second step would be using the script few times in pipe as follows: type input.txt|script.bat ...|script.bat ...|script.bat ... > output.txt Is it possible to use either of the following syntax: type input.txt|script.bat ...

Python bash pipe

I want to pipe a python script's output to a bash script. What i did so far was i tried to use os.popen(), sys.subprocess(), and tried to give a pipe for an example os.popen('echo "P 1 1 591336 4927369 1 321 " | v.in.ascii -zn out=abcx format=standard --overwrite') but this didn't work, the values "591336" and "4927369" are the variab...

Lost in Multiple Fork(), Pipe() and Select()

Hello, Hope I can find some help here cause I'm starting to give up. Heads up as this is an homework assignment, hence why it might be stupid. Context: Have to program something which will be shell executed as such: logn [--tick n] cmd [args] [, cmd [args]]... Basically, it's a program that multiple programs simultanously. Constraint...

Having trouble with pipes and select()

Hello, I seem to be having trouble with pipe and select. Context: Have to program something which will be shell executed as such: logn [--tick n] cmd [args] [, cmd [args]]... Basically, it's a program that multiple programs simultanously. Constraints: Each output line has to start with it's command number in front in format printf ...

Create XMLList containing multiple nodesets

Hi All, I have scoured the internet trying to find an answer to this...I must be asking the wrong question?! <a> <b> <c/> <c/> </b> <a> <b> <c/> </b> </a> </a> var x:XMLList = node.a | node.b.c; <-- compiler error var x:XMLList = node.a || node.b.c; <-- nothing and probably not correct syntax I want a | ...

TCP Socket Piping

Suppose that you have 2 sockets(each will be listened by other TCP peers) each resides on the same process, how these sockets could be bound, meaning input stream of each other will be bound to output stream of other. Sockets will continuously carry data, no waiting will happen. Normally thread can solve this problem but, rather than cre...

How can I pipe input into a Java command from Perl?

I need to run a string through a Java program and then retrieve the output. The Java program accepts the string through standard input. The following works: my $output = `echo $string | java -jar java_program.jar`; There is one problem: $string could be just about anything. Any thoughts on a good solution to this problem? ...

How do you specify filenames within a zip when creating it on the command line from a pipe?

I'm trying to create a zip file from file contents which are being piped in, e.g. mysql [params and query] | zip -q output.zip - This writes the zip correctly, but when you open the zip, the file within it is called "-". Is there any way of specifying what the filename of the piped in data should be within the zip? ...

port pipes all requests to a php file

how can I setup httpd.conf so that I can pipe all requests to that port go to a php file? I am trying to make a socket connection from action script to localhost in flash. ...

Pipe R commands and results from within a for loop to a file

We want to log the commands and results of a R script into a text report file. The pipe into the text file works well with sink(), but not within a for loop. The script is called with source("myscript.r",echo=TRUE) We need the loop to extract all rows of a data.frame consecutively into a vector and do some vector based analysis with ...

real time subprocess.Popen via stdout and PIPE

I am trying to grab stdout from a subprocess,Popen call and although I am achieving this easily by doing: cmd = subprocess.Popen('ls -l', shell=True, stdout=PIPE) for line in cmd.stdout.readlines(): print line I would like to grab stdout in "real time". With the above method, PIPE is waiting to grab all the stdout and then it retu...

Ruby Switch Between File and Standard Input

How would you create a variable that could be read. It would read from a certain file if it exists, otherwise it would read from standard input. Something like: input = File.open("file.txt") || in This doesn't work, but I think this should be done pretty often, but I can't find a nice way to do it. ...

Python readline on a pipe that has been opened as non-blocking

I have a Linux fifo that has been opened in non-blocking mode. As expected, when I call read on the file object, it returns immediately. I use select to make sure there is no busy waiting, but that my program is still notified when there is any data available. Out of curiosity, I tried the readline function and was surprised to find that...

PHP extracting body and attachments from piped email

I understand there are php IMAP functions to extract certain elements from an email stored in a mailbox. What I am trying to discover is whether this can translate to emails piped to a script. The scripts that I have looked at for extracting the body and attachments are fairly inflexible and bulky. I sent my pipe script a variety of dif...

Script: SSH command execute and leave shell open, pipe output to file

I would like to execute a ssh command and pipe the output to a file. In general I would do: ssh user@ip "command" >> /myfile the problem is that ssh close the connection once the command is executed, however - my command sends the output to the ssh channel via another programm in the background, therefore I am not receiving the output...

How can I set the encoding on a Perl pipe?

Hello! Is "'|-:encoding(utf-8)'" in "open my $column, '|-:encoding(utf-8)', qw(column);" ok? It seems to work almost. In the row with the "Mikołaj" the formatting is not correct; how can I fix it? #!/usr/bin/perl use warnings; use strict; use utf8; binmode STDOUT, ':encoding(utf-8)'; # edit: binmode DATA, ':encoding(utf-8)'; open my $c...

how do I paste text to a line by line text filter like awk, without having stdin echo to the screen?

I have a text in an email on a windows box that looks something like this: 100 some random text 101 some more random text 102 lots of random text, all different 103 lots of random text, all the same I want to extract the numbers, i.e. the first word on each line. I've got a terminal running bash open on my Linux box... If these were ...

How to read from stdin or from a file if no data is piped in Python ?

Hi, I have a CLI script and want him to read data from a file. It should be able to read it in two ways : cat data.txt | ./my_script.py ./my_script.py data.txt A bit like grep, for example. What I know: sys.argv and optparse let me read any args and options easily. sys.stdin let me read data piped in fileinput make the full proce...