Pipes or named pipes are a feature of the POSIX standard that allow separate processes to communicate with each other without having been designed explicitly to work together.

learn more… | top users | synonyms

0
votes
1answer
1k views

Unix pipe: find | ln -s

I'm trying to symlink some php files using the following command: find `pwd` -name "*.php" | ln -s * /home/frankv/www/bietroboter.de/symlinks However, all the symlinks are broken because the little ...
0
votes
2answers
2k views

How can I curl the output of another command

I want to pass curl the output from awk ./jspider.sh http://www.mypage.com | grep 'resource' | awk '{print $4}' | curl OUTPUT_FROM_AWK | grep myString How can I achieve this?!
1
vote
1answer
760 views

How to solve “Broken Pipe” error when using awk with head

I'm getting broken pipe errors from a command that does something like: ls -tr1 /a/path | awk -F '\n' -vpath=/prepend/path/ '{print path$1}' | head -n 50 Essentially I want to list (with absolute ...
0
votes
0answers
103 views

mutt colorizing piped messages

Viewing messages in mutt are colorized, but piping them through the less pager removes colorization. How do I preserve message colorization? I've tried: | less -R but colorization is stripped ...
1
vote
1answer
499 views

pipe from ssh to windows “ssh server 'tail err.log' | tool.exe”

I want to live monitor a logfile generated on a remote linux host with a windows tool. I'm looking for something like: $> ssh remoteserver 'tail -F /var/log/err.log' | tool.exe But on Windows. ...
1
vote
2answers
962 views

How to find the last match of a string in a bunch of files

I have a bunch of files, I'd like to find the last match of a string in each of them. grep text *.file gives me all the matches not the last ones. ls *.file | xargs grep text | tail -n 1 gives me ...
2
votes
2answers
2k views

Preserve colors while piping to tee

ls -l --color=auto | tee output.log Without pipe/tee it's colored. How can I make it so that it stays colored while using tee (can be colored only on the screen, I don't care about colors in logs).
1
vote
2answers
772 views

File name with spaces piped to two xargs commands

I have a directory and many more subdirectories like the following - file with spaces.txt filewithsuperlonglines.txt ordinaryfile.txt binaryfile.bin The command - find . -type f -print0 | ...
0
votes
1answer
820 views

“find | grep | awk” fails miserabily

I'm scanning for all shell scripts on my server, and are doing this by the following command: find / -type f -exec file --mime-type {} \; | grep "text/x-shellscript" This is working fine, and here ...
5
votes
3answers
4k views

How can I specify command line arguments using pipes in Linux?

I'm a newbie to shell programming and have no idea how to solve this problem. I just downloaded a file from the Internet to the default directory ~/Downloads. I want to move that file to another ...
0
votes
1answer
158 views

exec command “who”: Broken Pipe && “ps”:bad namelist

I typed "who" under Freebsd4.5, the information showed as below: stdout: Broken pipe ...... but showed "test ttyp0 Sep 20 20:39 (192.X.X.8)"last line. and exec command ps, it returns ...
3
votes
1answer
2k views

Notepad++, Run command and open output in new tab

Is there any way to execute a command from notepad++ and have the results piped back into the program in a new tab?
2
votes
2answers
8k views

Netcat/socat behavior with piping and UDP?

I guess this is close to linux - Netcat stops listening for UDP traffic - Super User, but I thought I'd better ask anyways As far as versions of netcat I'm using Ubuntu 11.04 and the default netcat ...
5
votes
1answer
2k views

extract a few members from tar archive and pipe through network

edit: I want to extra member01 and member02 and directory blah/ tarball_1.tar.gz contains directory test/ with 20 files. I want to extract only member test/member01 and test/member02 and directory ...
3
votes
3answers
3k views

How can I grep in source files for some text?

At the moment I'm using two commands, I'm sure there must be a better way... wim@wim-acer:~/ffmpeg$ find . -name "*.h" -print0 | xargs -0 grep -i invalid\ preset wim@wim-acer:~/ffmpeg$ find . -name ...
23
votes
6answers
3k views

What is the general consensus on “Useless use of cat”?

When I pipe multiple unix commands such as grep, sed, tr etc. I tend to specify the input file that is being processed using cat. So something like cat file | grep ... | awk ... | sed ... . But ...
11
votes
4answers
22k views

How can I pipe output of ffmpeg to ffplay?

How can I pipe the output of ffmpeg to ffplay? At the moment I use a workaround in bash : mkfifo spam (ffplay spam 2> /dev/null &) ; capture /dev/stdout | ffmpeg -i - spam
12
votes
2answers
26k views

Howto pipe: cp | tar | gzip without creating intermediary files?

Can anyone tell me if it's possible to pipe | this without having to create a physical file anywhere between A and B.tar.gz? This is what I'm trying to do: File A Rename A to B Tar B.tar gzip -9 ...
3
votes
1answer
2k views

How long do FIFOs (named pipes) stay “open” for?

For example, I have a script that writes the time to a pipe in /etc/pipe. It writes continuously in a while true loop. How long will the data in the pipe be available for reading? If I only decide to ...
10
votes
3answers
11k views

Passing two arguments to a command using pipes

Usually, we only need to pass one argument: echo abc | cat echo abc | cat some_file - echo abc | cat - some_file Is there a way to pass two arguments? Something like {echo abc , echo xyz} | cat ...
3
votes
1answer
3k views

Sniff process communication on Windows 7

I have two local processes which communicate to let the other execute commands. And I want to know what they are talking about. After some first investigation, it's not over Sockets or Loopback, but ...
1
vote
2answers
3k views

How to feed grep output into scp?

I have a file where each line is a file name. Content of the file: file1 file2 file3 ... I then run a grep command to get a subset of the list of the file names. How do I feed the output of the ...
2
votes
1answer
87 views

Which is better: using flags, or pipes?

As with many things in the *nix world, there is more than one way to generate .tar.gz files. Typically, I use the following: tar zcf /path/to/dir.tar.gz /path/to/dir However, I have seen the ...
3
votes
2answers
802 views

Pipes, shell scripts and ulimit

I have a command that I'm calling from code: execvp('generate', ...) which is an executable program that my code communicates with via stdin, stdout and stderr. This works fine, not a single ...
12
votes
5answers
6k views

What is a “pipe” and how can it be “broken”?

I've gotten the "broken pipe" error from Xcode one time too many. I'm now curious to know exactly what a pipe is. What is the concept of a "pipe" and how can it be "broken"?
0
votes
1answer
30 views

Piping results back into the program that generates them

I've got a program that can take input from stdin and produces output in the stdout like this: cat initial_input.txt | myprogram myindex myoptions - | filter_output > outfile.txt The program ...
1
vote
2answers
816 views

Pipe screen buffer to another command?

I can't seem to find anything on this so, is there a way to pipe everything from a screen window into another command. I have a server running in screen (not the best idea, but the only way for the ...
39
votes
5answers
7k views

How can I save the current contents of less to a file?

If I've piped the results of a command to less and then decided that I want to save the contents to a file, is this possible? I've tried setting a mark a at the end of the buffer, and then returning ...
2
votes
1answer
232 views

Is there any way to pipe local output to an SSH server as well?

Is there any way to set up a local process, but have the output also go to a terminal that has SSH'd into my machine?
3
votes
1answer
695 views

Linux: redirecting stdout and stderr

I want to write stdout to a file but also prints stdout and stderr. I tried using tee: prog | tee stdout.txt but this causes the printed stderr and stdout to be interleaved incorrectly, i.e. if the ...
9
votes
1answer
919 views

Is backwards redirection the same as a pipe?

In Linux if you type sort < txtfile is that the same thing as cat txtfile | sort
6
votes
1answer
5k views

Is it possible to pipe a list of files to RMDIR on Windows?

I am writing a batch file for the Windows command prompt to delete all directories matching a certain expression. I am first using DIR to return a plain list of directories matching the expression. I ...
2
votes
2answers
3k views

BASH - Check if unnamed pipe is empty

My problem is, I want a script which reads content from a pipe, checks if it's empty and output it if not, as seen here: #!/bin/bash var=$(cat -) if [ -n "$var" ] then echo "$var" else echo ...
1
vote
2answers
1k views

Split a large .gz file and gzip each of split file?

I have a large text.gz file (2GB) and I want to split it by line. I tried to use: zcat text.gz | split -l1000000 However this generated a huge file (around 92GB before I terminated it) and put too ...
10
votes
1answer
6k views

how to escape pipe symbol | in bat scripts?

I need to echo commad usage like this in batch script named command.bat command.bat on|off I cant use echo %0 on|off I know I can use echo "%0 on|off" but it puts quotes along Is there any ...
2
votes
3answers
1k views

Linux: Limiting data throughput (pipe) in bytes per second?

I was wandering if there is a Linux program that can limit data throughput of a pipe - in actual bytes per second?. From what I gather, applicable for the purposes would be bfr, however, it has ...
6
votes
2answers
2k views

How do you determine the actual command that is piping into you?

Let's say I have a bash script called log.sh. In this script, I want to read in input from a pipe, but I also want to know the command used to pipe input into me. Example: tail -f ...
0
votes
1answer
501 views

OS X: log text from serial port

I have a text stream coming in on a USB-RS232 adapter. I want to pipe it to some Unix tools, to a file, whatever. What is the simplest way to do so? Does it really require third-party software? OS X ...
4
votes
3answers
2k views

Windows how to redirect file parameter to stdout? (Windows equivalent of `/dev/stdout`)

Windows console: Tool A can write binary data to a file, but has no option for telling it to use stdout. Tool B can read binary data from stdin and process the info in it. How can I get the output ...
10
votes
2answers
4k views

Comments in a multi-line bash command

This single-command BASH script file is difficult to understand, so I want to write a comment for each of the actions: grep -R "%" values* \ | sed -e "s/%/\n%/" \ | grep "%" \ | grep -v " % " \ | ...
2
votes
4answers
3k views

How to redirect the output of a program to the Linux diff command

I have a program that writes to stdout. Is there a way that I can redirect the output to the Linux diff command or do I have to write the output to a file and then compare that? For example, I have a ...
3
votes
1answer
6k views

Pipe/send command to process running on nohup that accepts input from STDIN

I have a program that I run using nohup program &. This program accepts input from STDIN. Is there any way to send text to the STDIN of a program that is running via nohup? This is on FreeBSD ...
6
votes
2answers
3k views

monitor interprocess pipe traffic

I have two Linux processes communicating via a nameless pipe. How can monitor the traffic in the pipe? How can I inject data into the pipe? I have root access and know the pipe inode.
1
vote
1answer
1k views

pipes & tail -f in linux

Is it possible to execute cat logfile | tail -f? For some reason it just reads the initial log, but then it doesn't update incoming entries. I know I can directly do tail -f logfile. I just wanted ...
0
votes
3answers
326 views

Command output redirection to vim not working on OS X

I'm trying to redirect the output of a command to vim using the - argument, but it doesn't seem to work on OS X. For example, if I type $ ls | vim - on the command line on one of my Linux ...
8
votes
6answers
4k views

Make a pipe conditional on non-empty return

Is there a way to pipe the output of one function to another, but only if there is an output?
3
votes
2answers
5k views

How to sort ls by column in Ubuntu via piping to sort?

I'm a Linux newbie trying to learn how piping works in the Ubuntu terminal. I tried to sort by file size: ls -al | sort -k5 The files were listed in this order: drwx------ 19 min10 domain users ...
6
votes
3answers
12k views

Why does this not work? “ls *.txt | xargs cat > all.txt” (all files into single txt document)

Why does this not work? ls *.txt | xargs cat > all.txt (I want to join the contents of all text files into a single 'all.txt' file.) find with -exec should also work, but I would really like to ...
1
vote
2answers
768 views

pipe a program into less

I'm taking the dive into setting up and learning git and at the same time learning bash. I'm trying to do something simple as view the help section of $ git config unfortunately, when I type that ...
11
votes
7answers
7k views

Advantages of cat'ing file and piping to grep

Are there any additional advantages of cat'ing a file and piping it to grep, besides convenience? The convenience being that, when I retrieve commands such as those below from my history, the cursor ...