Questions tagged [pipe]
A Unix pipe connects file descriptors of two processes. A pipe is created with the POSIX pipe() function declared in <unistd.h>. Shells provide pipe creation between processes using "|".
1,888 questions
0 votes
1 answer
38 views
`xargs sh -c` not picking up last argument (vs `for i in $(...)`) [duplicate]
I just wanted to build a simple bash script that inverted a 'hex color code' (made up of 3 pairs of 2-digit hexadecimal numbers, in the format #RRGGBB). In my first code block I attempt to perform ...
3 votes
1 answer
208 views
grep does not work on output from `dnf check-release-update`
I'm using Amazon Linux 2023 dnf check-release-update --version-only 2023.9.20251027 2023.9.20251105 now I want grep output but it does not work dnf check-release-update --version-only | grep "...
4 votes
2 answers
525 views
how to tell, from the outside, if the output stream of a process has been closed?
Suppose you have this script, on an Ubuntu machine: #!/bin/env python3 import sys import time try: i = 1 while True: print(i) i += 1 except Exception as e: sys.stderr.write(f"We ...
3 votes
1 answer
450 views
Understanding file descriptors and pipes resulting from `cat <(<command>)`
I don't understand the following: $ cat <(sleep 60) & jobs -l [1] 63813 [1]+ 63813 Running cat <(sleep 60) & /proc/63799/fd$ ps --forest PID TTY TIME CMD ...
0 votes
0 answers
38 views
How can I grep the output of ffprobe? [duplicate]
I'd like to only see those lines containing "Stream #" from an ffprobe output. But whatever I do, it continues to show the whole output. Neither "|" nor ">" pipes work....
0 votes
2 answers
88 views
One-liner piping from find/xargs with paths including spaces
The following question likely does not relate specifically to Vim. I use a Vim example, as this is where I encounter the issue. Working on Ubuntu, I often open multiple files in Vim using tab pages: $ ...
0 votes
2 answers
187 views
How can I run if statements on a command output without terminating it?
I have to run four separate if statements (and their consequences) on one command output continuously as it updates (doing four different things based on four different strings which might be in the ...
3 votes
2 answers
167 views
What explains this very odd behavior of GNU grep interacting with buffering and pipes and how to stop it?
This is best illustrated with an example I feel: { printf 'foo\nbar\n' ; sleep 2 ; } | grep -m1 foo { printf 'foo\n' ; sleep 2 ; printf 'bar\n' ; sleep 2 ; } | grep -m1 foo Both of these commands, ...