Skip to main content

All Questions

Tagged with
3 votes
2 answers
100 views

Equivalent for pipe() in bash or other shell

In libc, there is an ability to create an (anonymous) pipe: https://man7.org/linux/man-pages/man2/pipe.2.html I am aware of mkfifo in bash and similar shells, and I am aware of the | which allows ...
Philip Adler's user avatar
  • 2,184
1 vote
1 answer
67 views

How to get available data in a pipe in linux

In Linux, after writing some data in a pipe (yet not read), when using fstat on read/write side of a pipe, the st_size field is zero. Is it possible to get the size of data available in a pipe? Sample ...
tahzibi.jafar's user avatar
0 votes
1 answer
56 views

Linux got stuck using pipe() and dup2()

I am simulating the linux shell pipe operator, and I got stuck. The below is the minimal reproducable example of what I tried. #include <stdio.h> #include <stdlib.h> #include <unistd.h&...
MyBug18's user avatar
  • 2,200
-3 votes
1 answer
51 views

How could I untar a file and then tar using pipe? [closed]

I have a tar file original.tar, and I need to untar it and then re-tar it for some reason. I do not want to untar it to disk and then tar from disk. I hope I can untar the file into stdout, and then ...
coin cheung's user avatar
  • 1,065
1 vote
1 answer
62 views

Piping input into running Python script

Maybe this is the wrong approach, so feel free to redirect. I am trying to asynchronously pipe input into a python script. The idea is that I have a background Python script do some long initial setup ...
BrettOC's user avatar
  • 69
0 votes
0 answers
67 views

How can I create multiple children using one parent with 2D array for UNIX using pipes and fork only?

I'm trying to write code that creates N processes 1, 2, 3, 4, ..., N for UNIX (using fork()), where N is given by the user. The processes can be created in any order. Each process must print ...
Izabela Nedyalkova's user avatar
1 vote
1 answer
28 views

python on Linux: os.pipe() with cumulative byte counter?

Is it possible to get a cumulative count of bytes written to an os.pipe()? I tried os.fdopen(...).tell() but got IOError: [Errno 29] Illegal seek. Is there some other way to wrap the fd to get a ...
personal_cloud's user avatar
1 vote
1 answer
79 views

Pipe an output into echo as an variable for calculation

My goal is to divide 2 text files, each containing a single integer, but limiting the answer to 2 decimal places. I managed to do it with paste total.txt count.txt | awk '{printf "%.2f\n", $...
Yitasha's user avatar
  • 157
0 votes
1 answer
44 views

Remote to server and run tmux in detached mode with pipe

I am trying to remote to server with ssh and run a tmux on the remote server with a command in detached mode. The command I want to run in tmux needs a pipe character. I have tried escaping the | ...
user1955162's user avatar
0 votes
1 answer
77 views

How to replace the occurrences of pipe (|) without replacing the pipe used as a delimiter

On Linux server, I have pipe-delimited files that have pipe (|) characters in some string columns. The files are pipe-delimited but the delimiter pipe is always in double quotes while pipes in the ...
Selim's user avatar
  • 3
2 votes
1 answer
96 views

(Bad file descriptor error) Pipe between a execl() C and a Python in Python program

I tried to exchange a string between Python and C programs using a pipe(), but I got nothing. After that I tried to exchange a string between two C programs using a pipe() and everything was fine. ...
Subado's user avatar
  • 21
0 votes
1 answer
78 views

Broken pipe while timestamping and appending to log file

I am running a python program like this nohup python3 -u /home/myuser/foo.py | ts '[%Y-%m-%d %H:%M:%.S]' &>> /var/log/mylogs/foo.log & The program processes input and prints output. It ...
kexu's user avatar
  • 306
0 votes
0 answers
33 views

How does python work with outside pipe and sys.stdin [duplicate]

In a Linux sandbox, I tried to run a python3 script from network by piping python3. And the script also reads data from sys.stdin. It was a little bit like : echo 'import sys ; print(f"python ...
rikuri's user avatar
  • 80
3 votes
2 answers
212 views

How to use “grep -f file-with-patterns” in a pipe where “file-with-patterns” changes frequently?

I am trying to do dynamic logging of dropped firewall events whereby I can dynamically specify what events not to log. I use: logread -f | grep -v -f file-with-patterns >> logfile in a script ...
Ernst's user avatar
  • 33
1 vote
0 answers
47 views

Named Pipes in Linux with Python read/write miss some lines of text

I am learning how to use named pipes to pass data between processes. To test it out, I wrote two Python scripts, which I called pipewriter.py and pipereader.py, and a named pipe called my_pipe (using ...
Paul Wintz's user avatar
  • 2,708

15 30 50 per page
1
2 3 4 5
109