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

7
votes
1answer
653 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
11
votes
2answers
4k views

Pipe gunzip and mysql to gunzip a dump and import it

I have a .gz sql dump file (example: foo.sql.gz) that i want import in my database with the classic mysql command. gunzip -c foo.sql.gz > foo.sql mysql -uroot -ppassword foo < foo.sql foo is ...
3
votes
3answers
2k 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 ...
8
votes
4answers
12k 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
73
votes
4answers
15k views

Less and Grep: Getting colored results when using a pipe from grep to less

I use the --colour option of grep a lot, but I often use less as well. How can I pipe grep results to less and still preserve the coloring. (Or is that possible?) grep "search-string" -R * --colour | ...
18
votes
4answers
17k views

How to pipe command output to other commands?

Example: ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files. ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ). ...
7
votes
2answers
6k 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 ...
1
vote
2answers
5k 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 ...
20
votes
6answers
2k 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 ...
1
vote
4answers
1k views

less emulate a TTY to preserve piped color output

When you pipe something through less, the program usually discards color codes because it's not outputting to a TTY. So you have to add --color=always to the options for it to work. ls -l ...
1
vote
2answers
515 views

Split an[d] archive large backup file in constant working space

I'm currently attempting to use tar and split to get DVD-sized archives of my Time Machine backup database. It's going to work this time, as I have a partition on my external drive large enough to ...
15
votes
2answers
979 views

What is the magic separator between filenames in ls output?

The output of ls (with no arguments) appears to separate filenames with linebreaks. Evidence: ls | grep foo works as expected, with grep treating each filename as a separate line of input. ls > ...
2
votes
3answers
1k views

Can I use pipe output as a shell script argument?

Suppose I have a bash shell script called Myscript.sh that need on argument as input. But I want the content of the text file called text.txt to be that argument. I have tried this but it does not ...
1
vote
2answers
896 views

How can I clear the contents of every file in a subdirectory without changing ownership / permissions?

I can find the list of files using something like: find /path/to/files -type f And I can clear the contents of a single file with any of: > filename echo -n > filename cat /dev/null > ...
1
vote
3answers
158 views

Piping file to a command that doesn't implement piping

$ cat foo foo bar Now if I do: $ some_program foo It's working. But if I try: $ cat foo | some_program It's not working. I'm looking for a clean way to pipe input to some_program without ...
0
votes
3answers
241 views

How to print out all non-hidden files recursively in a dir using lpr

find . -type f | grep -v '/\.' lists out all non-hidden files in the current dir recursively. Example of this command given the following file tree . ├── css │   ├── base.css │   └── main.css ├── ...