piping

Piping as interprocess communication

I am interested in writing separate program modules that run as independent threads that I could hook together with pipes. The motivation would be that I could write and test each module completely independently, perhaps even write them in different languages, or run the different modules on different machines. There are a wide variety...

Python piping on Windows: Why does this not work?

I'm trying something like this Output.py print "Hello" Input.py greeting = raw_input("Give me the greeting. ") print "The greeting is:", greeting At the cmd line Output.py | Input.py But it returns an EOFError. Can someone tell me what I am doing wrong? Thanks for your help. EDIT Patrick Harrington solution works but I don'...

writing data from a program to a file

I'm using linux. Let's say I have a program named add. The program takes two numbers. so if I type in add 1 2 the answer is 3 //obvious what command will make this write out to a file named add.data I'm kind of a linux n00b. I was reading about piping. Thanks. ...

PHP Mail Piping

Hi, I don't know much about this and was just curious because i had an idea :) I know with my cPanel hosting i can pipe an email inbox to a script, but what i want to do is: send to [email protected] pipes to mail.php mail.php reads the subject, and a .txt attachment the contents of the subject and .txt attachment are stored in the database ...

Problem with piping commands in C

Hi, I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second command. For example, if I type "ls | wc", it will pause after the "wc" command, which...

Lisp chaining functions macro

Is there a ready made lisp macro that allows chaining (piping) of functions? I couldn't find one. I'll try to explain what I mean with this example. Instead of using let* with lots of unused intermediate variables like this: (let* ((var1 (f1 x y)) (var2 (f2 x var1)) (var3 (f1 var2 z))) var3) I would like to have it written l...

piping in UNIX doubt

In The Unix Programming Environment by K & P, it is written that " The programs in a pipeline actually run at the same time, not one after another. This means that programs in a pipeline can be interactive;" How can programs run at same time? For ex: $ who | grep mary | wc -l How grep mary will be executed until who is run or how wc -...

Pipe implementation

I am trying to implement a linux shell that supports piping. I have already done simple commands, commands running in background, redirections, but piping is still missing. I have already read about it and seen some snippets of code, but still haven't been able to sort out a working solution. What I have so far: int fd[2]; pipe(fd); ...

Combining echo and cat on Unix

Really simple question, how do I combine echo and cat in the shell, I'm trying to write the contents of a file into another file with a prepended string? If /tmp/file looks like this: this is a test I want to run this: echo "PREPENDED STRING" cat /tmp/file | sed 's/test/test2/g' > /tmp/result so that /tmp/result looks like this: ...

Making C code plot a graph automatically.

I have written a program which writes a list of data to a '.dat' file with the intention of then plotting it separately using gnuplot. Is there a way of making my code plot it automatically? My output is of the form: x-coord analytic approximation x-coord analytic approximation x-coord analytic approximation x-coord ...

CPanel Email Piping to PHP

I have created a pipe script in CPanel and have placed the hashbang:#!/usr/bin/php -q at the beginning of my script. The script does run and places a log of the email into a table in my DB as it should. But...It sends an email back claiming that the email did not go through and appears as... This message was created automatically by mai...

C#: Foreign EXE input/output pipe from variable string

Currently my application takes in a text file/files, parses them into another file type and puts them on disk. I then call a secondary program (not mine) to process THAT text file into a third. The foreign program basically does one thing: program.exe --input:foo.txt --output:bar.txt What I would like to know... could I replace th...

Java: Using the Scanner class to read input from a file without pipeing.

I currently have an implementation of a program where I read in the input using the Scanner class. Integer by integer. I do this by piping the input file via the command line. java program < input.txt I need to avoid piping the input by using an argument on the command line to open the file in my program. java program --file=in...

Piping output of C program to file (bash)

I'm just trying my hand in bash, so I wrote a simple program in C to count the number of characters in a file. This is my C program: #include <stdio.h> int main() { int i, nc; nc = 0; i = getchar(); while (i!=EOF){ nc = nc + 1; i = getchar(); } printf("%d\n",nc); return 0; } This is the bash command I'm using ...

PowerShell ForEach / Piping confusion

I am using the TFS PowerTools Cmdlets in PowerShell to try to get at some information about Changesets and related WorkItems from my server. I have boiled the problem down to behavior I don't understand and I am hoping it is not TFS specific (so someone out there might be able to explain the problem to me :) ) Here's the only command th...