Questions tagged [pipe]

A pipe is an interprocess connection between file descriptors of two processes. A pipe is created with the POSIX pipe() function (from ). Shells create pipes between processes if the "|" symbol is used: "cmd1 | cmd2" directs the output of cmd1 to the input of cmd2. On Windows use CreatePipe(). This mechanism redirects standard input, standard output, and standard error into the calling process in .NET and Java.

Every program that runs on the command line has three data streams connected to it: STDIN(0) - standard input, STDOUT (1) - standard output - data printed by the program, STDERR(2) - standard error.

There are ways to connect streams between programs and files called piping and redirections.

Piping is a mechanism for sending data from one program to another using the "|" operator. The operator feeds the output from the program on the left as input to the program on the right.

Example

$ cat two_columns
column1:cloth
column2:strawberries
column3:fish
column4:chocolate
column5:punch cards
$ cat two_columns | awk -F: '{print $1}'
column1
column2
column3
column4
column5 
$ cat two_columns | awk -F: '{print "HAS: " $2}'
HAS: cloth
HAS: strawberries
HAS: fish
HAS: chocolate
HAS: punch cards 

Useful Links

9809 questions
3
votes
2 answers

Why does /bin/sh hang when ran via execl on this particular script?

Can you give me some ideas on the following code? The code runs but it doesn't exit. The other string, s="ls -1" works well. Running the shell snippet via sh(1) works just fine also. #include #include int main(int argc, char…
3
votes
0 answers

Why doesn't O_CLOEXEC/FD_CLOEXEC flag work?

I have a parent process having some children which don't need the FIFO descriptor opened by the parent before forking. I have tried to do the following approaches that fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); after opening the fd. fd =…
3
votes
1 answer

Is dup2 the correct way to simulate the behaviour of command sequencess in a linux terminal?

I'm trying to simulate the behaviour of the terminal in linux building a minishell in c code, but I've encountered a problem when trying to implement command sequences, since the output of the first one won't be properly received by the next one…
alestarbucks
  • 119
  • 1
  • 9
3
votes
2 answers

Using and Overlapped Named Pipe in Python 3.7

I am using Windows with Python 3.7 and I am trying to asynchronly share data, ony strings, between to python processes. One of the is running indefinitely (reciever), the other one may start at any point sends some data and then ends (sender). I am…
Finn
  • 2,333
  • 1
  • 10
  • 21
3
votes
2 answers

Transform Observable to Observable

I have an api that returns me an Array of ids, given an original id (one to many). I need to make an http request on each of these ids to get back the associated data from the api. I cannot figure out how to take the Observable and…
Buttars
  • 53
  • 6
3
votes
2 answers

How do I programmatically feed data into a python 'input()' prompt?

I'm using a python wrapper for the Spotify API. https://spotipy.readthedocs.io/en/latest/#installation As part of the authorization process, the Spotify API has the user login to Spotify in their default web browser, then sends them to a predefined…
Gaun
  • 43
  • 6
3
votes
1 answer

Combining Enum.map and Enum.each

I'm a neophyte of Elixir and I'm learning and reading something about list/enum usage and function piping. I learned how to combine Enum.map and Enum.each, e.g. manipulating the content of a list and printing the results list to console…
Pietro Martinelli
  • 1,776
  • 14
  • 16
3
votes
1 answer

rxjs takeUntil do not execute finalize

I have the following countdown: userClick=new Subject() resetCountdown(){this.userClick.next()} setCountDown() { let counter = 5; let tick = 1000; this.countDown = timer(0, tick) .pipe( take(counter), map(() =>…
farahm
  • 1,326
  • 6
  • 32
  • 70
3
votes
5 answers

stringLowerCase filter to apply on ngFor

I'm defining a pipes example in my application, which transforms the uppercase string to lowercase ex: 'Activities' => 'activities'. And the data is in the Array format and I am applying this filter on *ngFor. It returns me an error saying…
Soujanya J
  • 121
  • 3
  • 12
3
votes
1 answer

Trying to implement piping in C - shell is hanging and not running commands

I'm trying to run this command ps -j | more. I think i've set up the pipes correctly, but for some reason it just hangs: I'm calling a fork that runs ps -j and a second fork that runs more and connecting them with pipes. For some reason this is…
doctopus
  • 5,349
  • 8
  • 53
  • 105
3
votes
2 answers

ReadFile does not return while reading stdout from a child process after it ends

I am working on my library which needs to capture and process the standard output (and err) of a child process as it runs. The problem arises when ReadFile is used to read the output, it does not return once the process ends (gets killed or…
TheDcoder
  • 509
  • 1
  • 7
  • 23
3
votes
1 answer

How to use pipes and signals correctly at the same time?

I have 2 children, and I want to send signals from children to parent, and an answer (random number, why? why not...) named pipe from the parent to each child. I have this code: #include #include #include
Gábor
  • 327
  • 1
  • 7
3
votes
4 answers

Call pipe on change with observable

I have a custom pipe for transform temperature value. I want call this pipe on started component (done) and when value of lang change (not working). Can you help me? My pipe: @Pipe({ name: 'temperatureConverter' }) export class…
Matthis.h
  • 849
  • 3
  • 14
  • 30
3
votes
2 answers

Detecting error using Perl system() with multiple piped processes

I'm trying to implement a MySQL database restore from a GPG-encrypted file. The following works perfectly well: my $status = system( "gpg --pinentry-mode loopback --passphrase $passphrase --decrypt $my_encrypted_backup_file" . " | " .…
yahermann
  • 1,539
  • 1
  • 12
  • 33
3
votes
1 answer

Getting an "Error in argument 1, char 3: option not found" when piping emails to a parser script

I'm getting an error when I try to send an email matching the criteria to pipe the emails to my php script. The error is: pipe to |/home/**********/**********/script.php generated by f1c8f287-02ea81a3-11a218b30839@**********.com The following…
ArabianMaiden
  • 505
  • 7
  • 24
1 2 3
99
100