1, pipeline overview and related API application1.1 Key concepts related to pipingThe pipeline is one of the original UNIX IPC forms supported by Linux and has the following features:
The pipe is half-duplex, the data can only flow in one direction, when two sides need to communicate, need to establish two pipelines;
Can only be used between parent-child processes or sibling processes (affinity processes);
Separate form a separate fil
.
Instance:
#可以相互转换情况 #输入重定向 [chengmo@centos5 shell]$ cat test.sh|
Grep-n ' echo ' 5: echo "very good!";
7: echo "good!";
9: echo "pass!";
11: echo "No pass!"; #"|" Both sides of the pipe must be shell command [chengmo@centos5 shell]$ grep-n ' echo '
In summary:
As can be seen from the example above, redirects and pipelines can be used in many cases
, the pipe command to the right, you must be able to receive the standard input stream command. Instance: [[emailprotected]shell]$cattest.sh|grep-n ' echo ' 5: echo "verygood!"; 7:echo "good!"; 9:echo "pass!"; 11:echo "nopass!"; #读出test. sh file contents, forwarded to grep as input via pipeline [[emailprotected]shell]$cattest.sh test1.sh|
a part of what we want, and grep is to analyze a line of information, if there is the information we need, the line is taken out, the syntax is thisgrep [-ACINV] [--color-auto] ' Find string ' filename-A : find Data in a binary file as a text file-C: calculate the number of times to find ' Find string '- I: ignores case differences, so case is considered the same-N: output line number by the way-V: Reverse selection, which shows the line without the
Grep command Chinese manual (info grep translation), grep Chinese manual
1. This article is the info man translation, which is basically translated according to the original text. There are several unavailable options that are not translated, but the original text is given for the integrity of the article.2. Some "(note:") in the Translation. You can add it for y
Organize from the networkUnix IPC includes: piping (pipe), named pipe (FIFO) and signal (Signal)Piping (pipe)Pipelines can be used for communication between affinity processes, and well-known pipelines overcome the limitations of pipe without name, so that, in addition to having the functions of a pipeline, it allows c
How to use pipeline Pipe of Angular2, and pipeline pipe of angular2
Pipeline Pipe can use data as input and convert and output data according to rules. There are many built-in Pipe in Angular2, such as DatePipe, UpperCasePipe, and currenpolicipe. Here we will mainly introduce how to customize
Communication between processes in Linux Named Pipe (FIFO)Name the pipe (FIFO), which is the same as the normal pipe. It is used as an intermediate postman to implement communication between two processes.The named pipe (FIFO) has the following features:1. The Named Pipe (FI
How does the internal pipeline implement-size, organization, ring queue?I. There are several ways of interprocess communication, this article mainly explains the understanding of pipelines. Pipelines are divided into anonymous pipes and named pipes. (1) piping (pipe): also known as anonymous pipes. is a half-duplex mode of communication in which data can only flow in one direction and can only be used between processes that have affinity. A process'
Communication effects between processes1. Data transfer: A process needs to upload his data to other processes2. Resource Sharing3. Process notification Events4, Process Control: Some processes completely control the execution of another process, such as debug State AHWe need to take full control of his every step of the operation;Communication development HistoryThe communication IPC between Linux processes evolved from the following sections:1. Communication between UNIX processes2. Communicat
Can't open named pipe to host:. pipe: MySQL, namedpipeThe following error is reported when mysql is connected to odbc: Can't open named pipe to host:. pipe: MySQL:According to the methods mentioned on the Internet, the official mysql statement did not work. The final solution is to delete the old odbc connection and cr
Recently I have followed some network protocols used by SQL Server, such as named pipe:
Named Pipe (Named Pipe) is a protocol used for LAN. Under this protocol, a part of the computer's memory is used by a process to transmit information to another process. The latter can be a local process or remote process.
In what scenarios will named
http://siqun.blog.163.com/blog/static/213496001201341231121720/Reprint Link: HTTP://HI.BAIDU.COM/HJ11YC/ITEM/9A2EA30CCA773077BFE97EFCNote: Add a little bit of contentinterprocess communication Fork Pipe pie_t usage (Pipeline mechanism communication)Each process has a different user address space, the global variables of any one process can not be seen in another process, so the process to exchange data between the kernel, the kernel to open a buffer,
Time Limit: 3.000 secondsTime Limit: 3.000 seconds
Background
Background
Filters, or programs that pass "processed" data through in some changed form, are an important class of programs in the UNIX operating system. A pipe is an operating system concept that permits data to "flow" between processes (and allows filters to be chained together easily .)In UNIX operating systems, filters are an important class.Program. The format of the data that i
Multiprocessing. Pipe ([duplex])Returns 2 Connection objects (CONN1, conn2), which represent both ends of the pipeline, and the default is two-way communication. If DUPLEX=FALSE,CONN1 can only be used to receive messages, CONN2 can only be used to send messages. Unlike Os.open, where Os.pipe () Returns 2 file descriptors (R, W) representing both readable and writableExamples are as follows:#!/usr/bin/python#coding =utf-8ImportOs fromMultiprocessingImp
: $ grep-v "^[^48]" data.f3, set the case Use-I switch can mask the case sensitivity of the month s E P t CODE: [Sam@chenwy sam]$ grep-i "Sept" DATA.F483 Sept 5ap1996 USP 65.00 lvx2c 189216 Sept 3zl1998 USP 86.00 kvm9e 234 You can also extract all the information for each row containing S E p T and S E P T in a different way [] mode. CODE: [Sam@chenwy sam]$ grep
Use a dual pipeline to communicate to two processes, no need to re-open process high efficiency "use a process to communicate over and over two pipelines four handles, two member variables two local variables" modify the code for single pipe 1 "Paste into the constructor:Modify the name of the variable after pasting into the constructor:The changes are as follows:The code selected above is the paste to be used when executing the command to the followi
First, when there is no data to read
O_nonblock Disable:read Call blocking, the process suspends execution until the data arrives.
The O_nonblock enable:read call returns a -1,errno value of Eagain.
The sample program is as follows:
/************************************************************************* > File name:process_.c > Author:simba > Mail:dameng34@163.com > Created time:sat Feb 2013 02:34:02 PM CST * * * / #include # Include #include #include #include #include #include
Multiprocessing. Pipe ([duplex])returns 2 Connection objects (CONN1, CONN2), representing the ends of the pipe, which are two-way traffic. If DUPLEX=FALSE,CONN1 can only be used to receive messages, CONN2 can only send messages. The Os.open is different from os.pipe () Returns 2 file descriptors (R, W) that represent both readable and writable
Examples are as follows:
Copy Code code as follows:
Multiprocessing. Pipe ([duplex])Returns 2 Connection objects (CONN1, conn2), which represent both ends of the pipeline, and the default is two-way communication. If DUPLEX=FALSE,CONN1 can only be used to receive messages, CONN2 can only be used to send messages. Unlike Os.open, where Os.pipe () Returns 2 file descriptors (R, W) representing both readable and writableExamples are as follows:#!/usr/bin/python#coding =utf-8Import OSFrom multiprocessing i
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.