pipes

recongnize and replace links in yahoo pipes with regex

would there be a formula to recognize any link out of rss feeds and replace them with a fix value with regex in yahoo pipes? ...

java doesnt seem to read my perl piped output intime and is filling up

I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of...

Reading child process' output as soon as some is available?

I've been trying various methods (popen, pipes + fork/exec, ...) to read a child process' output, all of which are working, but exhibit the same behavior: whenever I try to read the output using read/fread, it only returns when the buffer is completely full, or when the child exits. I'm looking for a behavior that's more like that of soc...

Bash: how to pipe each result of one command to another

Hi All, I want to get the total count of the number of lines from all the files returned by the following command: shell> find . -name *.info All the .info files are nested in sub-directories so I can't simply do: shell> wc -l *.info Am sure this should be in any bash users repertoire, but am stuck! Thanks ...

Trouble restoring stdout after being redirected to a child process that exits

Currently I have a main process that creates an anonymous pipe and a child process and then uses the pipe to redirect console output to the child process. The pipe is created with CreatePipe, the read handle is passed as the StdIn handle for the new process using CreateProcess, and stdout of the main program is redirected to the write h...

observing stdout of another process

Here's the hypothetical scenario: I'm running a test script on some hardware attached to box A, which I have root access to. This test script requires minimal user input (flip a switch every half hour or so). About an hour and a half into the test process, I realize that this script takes a long, long time to finish, to the tune of eig...

How to: Monitor progress of data in a pipe?

Have a 1MB pipe: if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024)) { printf("CreatePipe failed\n"); return success; } Sending 4000 bytes at a time (bytesReq = 4000) while ((bytesReq = (FileSize - offset)) != 0) { //Send data to Decoder.cpp thread, converting to human readable CSV if ( (0 == WriteFile(hWrite, ...

How does a smaller pipe speed up data flow?

Have a 1MB pipe: if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024)) { printf("CreatePipe failed\n"); return success; } Sending 4000 bytes at a time (bytesReq = 4000) while ((bytesReq = (FileSize - offset)) != 0) { //Send data to Decoder.cpp thread, converting to human readable CSV if ( (0 == WriteFile(hWrite, ...

Is there an equivalent of less for SQL*Plus?

Sometimes a query on SQL*Plus might yield too many rows t fit on the screen. Is there some equivalent of "piping to less/more" mechanism that I can do to navigate the results? select * from emp | less ...

Why doesn't "set -P" work after a pipe?

C:\>type c:\output.txt abcd C:\>type c:\output.txt | set /p V1= C:\>set ... A bunch of junk, NOT seeing "V1" What happened? According to all documentation for SET I've seen, %V1% should have been assigned a value of "abcd" from the above, no? I'm on Windows XP Pro, SP3 if it matters. ...

Does SQL*Plus natively allow queries to run from the shell itself?

For example, is there equivalent of these in SQL*Plus sqlplus 'SELECT * FROM emp' | less sqlplus 'SELECT * FROM emp' | grep Primx One way has been suggested by paxdiablo here. Is that the only way? ...

Using xargs to assign stdin to a variable

All that I really want to do is make sure everything in a pipeline succeeded and assign the last stdin to a variable. Consider the following dumbed down scenario: x=`exit 1|cat` When I run declare -a, I see this: declare -a PIPESTATUS='([0]="0")' I need some way to notice the exit 1, so I converted it to this: exit 1|cat|xargs -I {...

Error Reading from a Pipe

void turtle (int gtot) { int msg; fcntl(gtot,F_SETFL,O_NONBLOCK); read(gtot,&msg,4); gotoxy(12, 21); printf("The value of buffer for turtle is %d",msg); //react to god's message xcoor += msg; msg = 0; sleep(sleep_time); } void god (int gtot ) { char choice, sign; int distance;...

Python subprocess problem

Hi, I'm writing a script to generate a CSR in Python. The script is very simple. I generate an RSA private key by using the following: keycmd = "openssl genrsa -out mykey.pem 2048" keyprocess = Popen(keycmd, shell=True, stdout=PIPE) csrcmd = "openssl req -new -key mykey.pem -subj "+ subj + " -out mycsr.csr" reqprocess = Popen(csrcmd, s...

What is the best way to create an rw pipe with c++?

I have a program A that needs to send commands to the stdin of a program B and reads back the output of this program B. (Programming in C++, not linux only) ProgramA -> send letter A -> ProgramB ProgramA <- output of B <- ProgramB I actually have the first part, send commands to B, working with popen(). I do know that popen is a one wa...

C# - how to close standard input and output streams on process exit?

I have a process that needs to launch a child process and communicate with it through standard input and output. The child process should be able to automatically terminate itself; however, I am having trouble closing the streams properly. Here is the relevant code from the child / "client" process: // This is started in a separate th...

Problem with piped filehandle in perl

I am trying to run bp_genbank2gff3.pl (bioperl package) from another perl script that gets a genbank as its argument. This does not work (no output files are generated): my $command = "bp_genbank2gff3.pl -y -o /tmp $ARGV[0]"; open( my $command_out, "-|", $command ); close $command_out; but this does open( my $command_o...

How do I make this compatible with Windows?

Good day, Stackoverflow! I have a little (big) problem with porting one of my Python scripts for Linux to Windows. The hairy thing about this is that I have to start a process and redirect all of its streams into pipes that I go over and read and write to and from in my script. With Linux this is a piece of cake: server_startcmd = [ ...

read from stdin for libxml2 in C

Hello, I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a program I am writing using libxml2. I can parse fine using a reader from the function xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename) when I have a char * to the name of the file. I would preferably like to wind...

Direct STDERR when opening pipe in perl

I am using open( my $command_out, "-|", $command_string ) to execute a command and process its output on the fly (not having to wait for the command to finish first, as in system()). I noticed that when I call some R scripts this way, some of R messages are printed to the screen (e.g. Loading required package: ...). I guess this is bec...