|
|||||||||
| UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers |
learn unix and linux commands |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
I am confused over piping. ![]() A | B Will A and B run at the same time? or must A finish running before B starts to run? Suppose I want to do the following: Code:
sqlplus ... | split -1000 - filename_ sqlplus will return 1million rows, I want write the output into files of 1000 records each. Does sqlplus finish running before split starts to run? I am concern with the huge amount of data in the pipe before split can even run... |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Here A must finish before B starts. Because The output of A is the input for B.
|
| Sponsored Links | ||
|
|
|
#3
|
||||
|
||||
|
Thank you.
|
|
#4
|
||||
|
||||
|
Quote:
If B tries to read from the pipe, but no data is available, B will wait until the data arrives. If B was reading from a disk, B might have the same problem and need to wait until a disk read finishes. A closer analogy would be reading from a keyboard. There, B would need to wait for a user to type. But in all of these cases, B has started a "read" operation and must wait until it finishes. If A tries to write to the pipe, and the pipe is full, A must wait for some room in the pipe to become free. A could have the same problem if A was writing to a terminal. A terminal has flow control and can moderate the pace of data. In any event, to A, it has started a "write" operation and will wait until the write operation finishes. A and B are behaving as co-processes, although not all co-processes will be communicating with a pipe. Neither is in full control of the other. In a case, like: A | sort The sort command cannot output anything until it reads all of the data. So the sort command will do that, just as it would if it was reading from a file. Many other programs strive to read and write data if they can. This allows them to be used in long pipelines with data continuously flowing though the entire pipeline. |
| The Following User Says Thank You to Perderabo For This Useful Post: | ||
jawsnnn (05-31-2012) | ||
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Quote:
|
| Sponsored Links | ||
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pipe to grep doesn't work in bash script | kcstrom | Shell Programming and Scripting | 4 | 02-11-2012 09:18 PM |
| Replace pipe with Broken Pipe | saj | Shell Programming and Scripting | 1 | 04-08-2011 10:18 AM |
| awk's getline < "-" seems not work for pipe | qiulang | Shell Programming and Scripting | 17 | 04-09-2009 06:41 AM |
| How to Avoid intermediate files when pipe does nt work | w020637 | Shell Programming and Scripting | 1 | 02-04-2009 07:19 PM |
| By angle-brackets/"pipe" button doesn't work? | riwa | Linux | 1 | 04-02-2006 07:43 PM |
|
|