Questions tagged [pipe]
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.
407
questions
2
votes
2
answers
4k
views
How to pipe output of command to another command while also displaying it on the console?
I want to write part of the results of a stream to a file, but I want the entire contents of the stream printed to the console. Is there some command that would help with this?
Minimal example:
Say I ...
0
votes
1
answer
108
views
Pipeline after sourcing a bashscript
I have a code
# Inside Child.sh
ChildVariable=BigChild
# Inside Parent.sh
source ./Child.sh
echo "ChildVariable=${ChildVariable}"
Output:
ChildVariable=BigChild
But,
# Inside Parent.sh
source ....
0
votes
1
answer
588
views
Skip N bytes every M bytes while reading from named pipe
I pipe data from one process to another, but this stream needs to be filtered.
The first process is ffmpeg and the second is ffplay. ffmpeg provides raw video frame for fplay to render, however it ...
2
votes
0
answers
824
views
In-place delta writes from a pipe
I'm looking for a way to only overwrites the parts of a file that differ from what's supposed to be written to it, so that the file is changed with the least amount of writes to disk possible.
My ...
0
votes
1
answer
724
views
Named pipe for inter-process communication [closed]
I want to use a named pipe for communication between a PHP server-script and a service, i.e. a process (a Python script) listening on the other end of the pipe. This service runs intentionally under a ...
0
votes
1
answer
358
views
Pass cronjob output as parameter to curl
I have cronjob that takes hourly backup. Now I want to pass any stderr to an API.
0 * * * * /usr/local/sbin/script.sh 2>&1 | curl -k -X GET "https://192.168.0.25/path/of/joomla/instance/index....
3
votes
2
answers
733
views
Use vim in pipeline to dump current line on exit to stdout?
Is it possible for me to do something like this:
$ ls | vim | xargs ...
and have vim pass to stdout any lines that were visually selected on exit?
If it'd be easier to just dump the "current line" ...
4
votes
2
answers
4k
views
GNU "parallel --pipe" doesn't process stdin by lines
I'm super confused about how to use GNU parallel to pass stdin to the job command.
I have what I imagined to be a really common use case. I have some process xxd that does something with stdin and ...
2
votes
1
answer
7k
views
using xargs pass arguments to sub shell with pipe
I want to rename a number of files. I think I can use xargs to do it.
find ./ -name "upload.log-*"
./upload.log-20180622.gz-20180624.gz-20180626.gz
./upload.log-20180624.gz-20180626.gz
./upload.log-...
1
vote
1
answer
793
views
Duplicating stderr output and merge with stderr in bash without changing order
I want to write both stderr and stdout to a log file, and print stderr to the terminal (or default output device).
Motivation: I have a command in my crontab, and I want to log all of its output to a ...
6
votes
1
answer
14k
views
How to concatenate two lines with `sed`?
I am trying to concatenate two lines of iwlist output. My grep and sed commands to remove leading and trailing spaces work fine but I can't get the last sed statement to remove the \n to work. What am ...
1
vote
1
answer
201
views
Using > and < inside a batch file, with a for loop
When doing this inside a test.bat file:
for %%i in (__src\*.js) do jsmin <"%%i" >"temp\%%~ni%%~xi" "(C) Example"
I was expecting to see:
D:\Temp>jsmin <"__src\background.js" >"temp\...
1
vote
2
answers
782
views
Linux bash - how to run a list of binary files that is generated from another script?
I have a script that generates list of binary files to be executed:
\home\joe\bin\script1
\home\joe\bin\script2
\home\joe\bin\script3
..
Question 1:
How can I run all of these files one by one from ...
19
votes
5
answers
143k
views
Get response body and show HTTP code by curl
I have endpoint which returns JSON (response body). I need get by curl the response body and process it (for example using jq). It works:
response=$(curl -s https://swapi.dev/api/people/1?format=json)
...
1
vote
1
answer
45
views
How can I use the Linux terminal to pipe only parts of program input concatenated with hard strings?
I understand that I can use xargs like this:
echo "-i inputfile.raw -o outputfile.jpg" | xargs -t ./myprogram
However, I am fuzz-testing the application and I have a fuzzer which works like this:
...
2
votes
1
answer
1k
views
How to add a custom parser for a file type into MC viewer?
When you press F3 on a .sqlite file in midnight commander the Viewer shows the SQL dump of the file instead of the original binary, and F8 can be used to switch between parsed and raw modes.
This ...
4
votes
2
answers
3k
views
Testing grep exit status with pipe and variable unsuccessful
I need as short as possible bash test command (bracket test) to evaluate result of piped grep with variable as search argument. I am testing, whether a new string is in the array - piping the array ...
1
vote
2
answers
2k
views
Pipe output from program to a dynamic named file (contains date)
I am still a bottle feeding linux newbie, so go easy. I've googled myself this far but can't find the answer.
I'm running a program that outputs csv data, and piping it to log.csv
I'm looking for a ...
2
votes
0
answers
69
views
Can a Win10 GURU automate this solution for splitting videos upon resolution changes? [duplicate]
Can a Windows10 Guru help automate this?
I have failed at automating Lord Neckbeard's solution in the following post:
How to split video files upon detected change in resolution? (ie. recorded ...
3
votes
1
answer
2k
views
Command line: How to handle spaces in filenames
I am measuring the total sizes of a bunch of files, whose paths I have stored in a text document, files.txt. Example contents of files.txt:
file1.txt
file2.txt
file3.txt
This shell command gives me ...
2
votes
0
answers
287
views
Proper permissions for postfix piped script
As my almost-alliterative title states, I am attempting to configure postfix to pipe incoming messages to a PHP script. As it currently stands, postfix apparently attempts to run the script as the '...
0
votes
2
answers
2k
views
How to pipe input to Wireshark in Windows Power Shell?
I am trying to run the following command in Power Shell:
C:\Users\mne\Desktop\plink.exe -ssh -pw abc root@myhost "tcpdump -w - -U -i vethf90673c 'port 5000'" | &"C:\Program Files\Wireshark\...
1
vote
1
answer
3k
views
Reverse shell using netcat on windows (no -e option)
Is there any way to get a reverse shell in Windows using netcat without using -e option since it triggers UAC?
I made it work from Linux to Linux by using a named pipe. I wanted to achieve something ...
-1
votes
1
answer
226
views
How to reverse piping properly?
I try to do reverse piping. More precisely, I try to reverse this statement:
echo 'user:passwd' | sudo chpasswd
I would like to get the 'sudo chpasswd' upfront. I tried both this:
sudo chpasswd ...
5
votes
3
answers
13k
views
Writing to a file from a udev RUN command
I am working on creating a udev ruleset that writes to a log file each time a certain USB drive is inserted. My ruleset, stored in /etc/udev/rules.d /99-log-USB-drive.rules, currently contains the ...
0
votes
0
answers
659
views
pipe a list of files to lrztar or lrzip
I know you can pipe the output of a ``find" command to tar, and then that file to lrzip, but I also know that will reduce the compression efficiency. I tried
find . -name "*.tex" |lrztar -n -o find....
0
votes
1
answer
174
views
Break down the following bash script?
I need help breaking down the following bash script, to understand what the author was trying to do. The script is meant to search a log file for data and then compare it to an email log file. ...
-1
votes
1
answer
150
views
Mercurial collapses lines into single line when piping output
I'd like to sort based on the output of a mercurial (hg) command. The output from hg log is collapsed into 1 line when piping to another command but I want to keep separate lines.
Here's a minimum ...
1
vote
1
answer
147
views
Piping StdOut adds more text
I am running a simple command (some Kafka related stuff):
curl localhost:8083
Its output is very simple:
root@debian:/etc/kafka# curl localhost:8083/
{"version":"0.11.0.0-cp1","commit":"...
3
votes
1
answer
1k
views
How to "tail" multiple pipe files or streams?
I need to monitor a lot of web servers for runtime errors and I have an idea of running a script like
#!/bin/bash -e
# Example set of hosts
HOSTS=(
host1
host2
)
for host in ${HOSTS[@]}
do
[...
1
vote
1
answer
503
views
What does this do? `Find ... -type d|xargs chmod 770`
What does these two lines do?
find /backup/folder -type d|xargs chmod 770
find /backup/folder -type f|xargs chmod 660
I googled around, but can't figure out what d|xargs and f|xargs does.
5
votes
3
answers
1k
views
Coerce scp(1), sftp(1), or rsync(1) into transferring a named pipe
I intend to transfer full and incremental backups of my btrfs subvolumes to a tape archival service. The service exposes FTP and SSH endpoints. If I were allowed to execute arbitrary commands on the ...
5
votes
1
answer
5k
views
Proper, if any, way to use dd as pipe buffer?
The Question
When I looked for pipe buffering tools in *NIX, I see suggestions of using buffer, mbuffer, or pv. However, the former two are not always in distros' official repo (such as Arch), while ...
0
votes
1
answer
233
views
How do I write a stream to a pipe on a remote machine
The below command works for file. But I see it doesn't work for a pipe
echo 'Some Text' | ssh user@remotehost "cat > /remotefile.txt"
I need to do tail -f of a pipe and want it to be written to ...
2
votes
1
answer
816
views
Piping with Process substitution and joining output again
I'm trying to make use of a powerful remote server in terms of video encoding.
I have a local DVD drive for ripping DVD to memory, finally residing in an mbuffer.
From there, I would like to split ...
1
vote
1
answer
578
views
echo stdin, unless empty, in which case cat a file
The pipeline fstdraw in.fst | dot -Tpng | convert - -rotate 90 out.png converts a file in a certain binary format into a PNG image.
Unfortunately, in some cases fstdraw emits zero bytes. (A bug in ...
0
votes
1
answer
4k
views
sending mail from command line: Null message body
I'm somehow unable to get my head around this. I am sending mails from commandline with help of a little script. But the line
echo 'LOREM IPSUM' | mail -s 'SUBJECT' -a 'From:TEST' < /root/...
1
vote
2
answers
3k
views
Piped xargs doesn't execute the command
I want to monitor nginx access.log for malformed requests and notify myself about such cases.
To do this i have written following command:
tail -n0 -f access.log | grep --line-buffered '\{' | ...
10
votes
2
answers
12k
views
filter outputs using select-string pipes
In bash, if I do the following, I will get all the environment variables with wd in them.
env | grep "wd"
Now, in Powershell, I know I could do
get-childitem env:wd*
But I want to pipe to select-...
2
votes
3
answers
4k
views
Windows command line - pipe output of dir search to (truncate) operation
This is Windows 10. The question is very simple, I simply don't know the proper syntax to do this.
This will list all files ending in .log:
dir /s /p *.log
This will truncate a file:
echo|set /p=&...
1
vote
0
answers
175
views
How to stream files to FFmpeg?
I am trying to create a video (MP4) from a bunch of images (JPEG). I am using FFmpeg for that. I know that I can pipe the contents of the images if they’re on the same server:
cat *.jpg | ffmpeg -f ...
3
votes
2
answers
4k
views
How to record or export the CACA output in FFMPEG?
I'm trying to export (pipe) the output device CACA in FFMPEG whithout sucsess.
The script work's fine, but no OUTPUT is recorded.
ffmpeg -i final3.mp4 -pix_fmt rgb24 -color fullgray -window_size ...
12
votes
4
answers
12k
views
Xargs pass input to command that contains a pipe
As a vehicle to understand how to manipulate binding precedence with pipes, I'm trying to print the path of one file per directory - for every directory:
find $PWD -type d | xargs --delimiter "\n" -I%...
1
vote
0
answers
2k
views
FFMPEG receive stream from pipe via netcat fails
I am trying to receive a stream via netcat and pipe it to FFMPEG and then output to a file, but I am getting an error.
The most basic command I tried was:
$ nc -l -p 1935 | ffmpeg -v debug -y -f ...
0
votes
0
answers
147
views
ffmpeg piping to aucdtect in a batch file
I am trying to pipe ffmpeg output to auCDtect in a batch file like this:
ffmpeg -i %1 -acodec pcm_s16le -f wav - ^| auCDtect.exe --
For some reason aucdtect just freeze at
Data analysis: [...
1
vote
2
answers
2k
views
Bash Sed Pipe to Command One-Liner
I'm trying to dump output from all of my interfaces. This is what I've got so far:
ifconfig | awk '{print $1}' | sed s'/.$//'
I'd like to have something like :
ifconfig | awk '{print $1}' | sed s'/....
0
votes
1
answer
365
views
Inplace modification of incron monitored files
I have samba share where users create video files, i need to stripe audio tracks from that video files and rsync new files to remote folder.
I monitor the samba share with CLOSE_WRITE option, to strip ...
1
vote
0
answers
96
views
Linux filter which convert data coming from pipe to chunked transfer encoding
I usually use Open3.popen3 in my Ruby CGI scripts to start a Linux command, parse its standard output and converting the bytes to the chunked transfer encoding ( https://en.wikipedia.org/wiki/...
4
votes
1
answer
7k
views
conditional pipe in bash
Is there any built-in way in bash to pipe output further if certain test condition is met?
Essentially I want to know if I have to write following function myself or is there some good-practice-...
-1
votes
1
answer
451
views
Create file - pipe to output
At first I must say that my English is not very well.
I have to do my task from studies and I have a problem. I have to make file with version in the proper catalog. Information are in text file for ...