Linked Questions

1 vote
3 answers
3k views

I need to pipe the output of one command to two other commands. cat filename.txt | tail -n 1 cat filename.txt | wc -l Since the file is huge I want to avoid reading it twice. I checked tee command ...
chhaya vishwakarma's user avatar
1 vote
2 answers
2k views

Is there anyway to redirect filtered output to multiple files by running mycommand.sh only once? Example output should be similar to this: mycommand.sh | grep --line-buffered -B 1 A >> file1 ; ...
Future's user avatar
  • 179
1 vote
2 answers
410 views

I'd like to print command output along with its input. For example for such call as echo "Hello world" | wc -c I want the following output: 12,Hello world Is there any way to do this using standard ...
Petr Razumov's user avatar
106 votes
9 answers
72k views

I know you can create a file descriptor and redirect output to it. e.g. exec 3<> /tmp/foo # open fd 3. echo a >&3 # write to it exec 3>&- # close fd 3. But you can do the same ...
dogbane's user avatar
  • 30.8k
31 votes
6 answers
12k views

I have an application which will produce a large amount of data which I do not wish to store onto the disk. The application mostly outputs data which I do not wish to use, but a set of useful ...
sj755's user avatar
  • 1,145
65 votes
3 answers
12k views

Some shells, like bash, support Process Substitution which is a way to present process output as a file, like this: $ diff <(sort file1) <(sort file2) However, this construct isn't POSIX and, ...
starfry's user avatar
  • 7,780
11 votes
4 answers
11k views

I have this command: cat somefile >file1 >file2 After I executed this command I can't figure out why file1 has nothing in it. It should have the output of the first file (somefile), but nothing ...
Charlie Albert's user avatar
5 votes
5 answers
1k views

I have a script outputting some value/numbers and I want to split those into two files. I am looking at something like: ./runme.sh | grep 'ook' >> ook.out | grep 'eek' >> eek.out Where ...
Sardathrion - against SE abuse's user avatar
4 votes
1 answer
6k views

I'm using FFmpeg and I have made a custom application which is a TCP server. I 'm using duplicate output in ffmpeg. What I want is, for each output I want to start my program to listen on a specific ...
user3393046's user avatar
2 votes
2 answers
6k views

I want to move files from server1 to server2. A producer on server1 will keep generating the files, and a consumer on server2 will keep processing them. I can copy files using the following shell ...
atripathi's user avatar
  • 295
5 votes
1 answer
3k views

I would like to send stdout to multiple commands, however I'm not sure how do I read from standard input within process substitution? My attempts: $ echo foo >(cat /dev/stdin) >(cat /dev/stdin)...
kenorb's user avatar
  • 22.1k
3 votes
1 answer
4k views

I am trying to take the input from a serial port and write it to a file and also then read the file and send it back out the serial port to the host computer. A coworker suggested using the "tee" ...
Julien's user avatar
  • 31
6 votes
2 answers
2k views

At first I thought this answer was the solution, but now I think I need a temporary file as buffer. This works unreliably: #!/bin/sh echo 'OK' | { { tee /dev/fd/3 | head --bytes=1 >&...
Kontrollfreak's user avatar
1 vote
1 answer
913 views

Somewhat re-asking my question since I mistakenly asked in SO with a bash shell tag and figured this is a more appropriate place. I'm writing a shell script within AWS DataPipeline that connects to a ...
simplycoding's user avatar
1 vote
1 answer
2k views

I'm trying to pipe the output of one command to two different awk commands. Following this post I am using tee and process substitution. However, I can't see the output for the substituted process. ...
ludog's user avatar
  • 17

15 30 50 per page