Skip to content
Advertisement

Tag: pipe

How to make pipe run sequentially

Specs Don’t think this should make a difference but I’ll include it anyway GNU bash, version 3.2.51 Premise So say i have a pipe with multiple parts, how can I prevent part of the pipe running before the previous part is finished. Example In the below examples I will try to display the issue Output With sleep to show that

How to grep a string in a program?

Description: The str_buf_to_grep is given in any way, which might be the content of a text file, and might be very long and complex, even contains special characters, such as |, “, etc. I want to use the grep command to find matched lines, and the patterns might be very complex. How should I implement it? Answer Use popen: The

C: Trying to implement unnamed pipes

I’m trying to make a program that simlutates the terminal’s nameless pipes. For example, if I want to run the command: ls –l | grep ‘10’ would be: ./pipes ls -l – grep ’10’ (I use – instead of |). However, my program doesn’t work because execvp fails (bad adress). This seems impossible to me. What am I doing wrong?

Linux-C: reading from pipe returns first buffer written to it

This program simulates a variant of Dijkstra’s Producer/Consumer problem. A pipeline is first created followed by a child process using fork(). The child will then write to the pipe a crudely done randomly generated piece of “stock market ticker information”. After waiting for the child/producer process to write this information, the parent/consumer process will read it out. The first output

Postfix transport_maps and virtual_mailbox [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question

Interpreting STRACE output – pipes and forks

I have the following code written in C, taken from https://beej.us/guide/bgipc/html/multi/pipes.html: When compiling and running this code in the terminal using strace I get the following output: Can anybody explain, line by line, what is going on in the strace output? I’ve attempted to research how to interpret strace outputs but haven’t had any luck. Thanks in advance. Answer The

How to make rsync read SRC from STDIN?

I want to dump my MySQL database and make daily backups with rsync. First approach I came up with is something like mysqldump -ufoo -pbar baz > /var/tmp/baz.sql && rsync /var/tmp/baz.sql /backup/ && rm /var/tmp/baz.sql. Then I started to wonder if it is possible not to use the temporary file /var/tmp/baz.sql, but instead to pipe the output of mysqldump directly

What is the proper place to put named pipes on Linux?

I’ve got a few processes that talk to each other through named pipes. Currently, I’m creating all my pipes locally, and keeping the applications in the same working directory. At some point, it’s assumed that these programs can (and will) be run from different directories. I need to create these pipes I’m using in a known location, so all of

Is there a way to improve performance of linux pipes?

I’m trying to pipe extremely high speed data from one application to another using 64-bit CentOS6. I have done the following benchmarks using dd to discover that the pipes are holding me back and not the algorithm in my program. My goal is to achieve somewhere around 1.5 GB/s. First, without pipes: Next, a pipe between two dd processes: Are

Why doesn’t “sort file1 > file1” work?

When I am trying to sort a file and save the sorted output in itself, like this the contents of the file1 is getting erased altogether, whereas when i am trying to do the same with ‘tee’ command like this it works fine [ed: “works fine” only for small files with lucky timing, will cause lost data on large ones

Advertisement