Skip to main content

Questions tagged [pipe]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

Send STDERR to console and file, STDOUT to file only

I have some script with STDOUT and STDERR output. By default, both STDOUT and STDERR goes to console: ./script.sh I can redirect STDOUT to file, leaving STDERR output in console: ./script.sh > log....
AntonioK's user avatar
  • 613
-1 votes
2 answers
221 views

mailx Set Name of Attached File

I have a cron job, whose output I send to mailx: # Monday morning at midnight; "mail" is symlink to "mailx" 00 00 * * mon python3 script-with-7500line-output.py | mailx -S 'from=...
Weylin Piegorsch's user avatar
1 vote
1 answer
426 views

How to make PowerShell read from a pipe?

I need to make PowerShell on Windows Server 2019 to read from a (not named) pipe and launch the commands it reads, so I'll be able to launch multiple commands on the same shell, even without knowing ...
Didi Kohen's user avatar
0 votes
0 answers
384 views

After piping Incoming mails to external script, mails are not shown in Inbox in iRedmail

I have been trying to pipe incoming mails to my python script which is just trying to read a mail and look for keywords and call api. But for some reasons my mails are not being delivered to my inbox. ...
misscoder's user avatar
0 votes
1 answer
2k views

Pipe into command stored in bash variable

I enter two command in bash: $export g='grep "something"' $echo "something and another thing" | $g But it doesn't work. I want the second command to be evaluated by bash as : ...
rooni's user avatar
  • 139
1 vote
1 answer
671 views

Why tail to same file create a empty file, or empty the file? [duplicate]

I try to maintain the last lines of a file, but when tail -n 10 test.txt > test.txt create or empty the file... SO: Ubuntu server Example: #test.txt file 20 May 23 12:24 test.txt a a a a a a ...
DarckBlezzer's user avatar
0 votes
2 answers
602 views

how to extract a certain field from standard output with cut?

I have this output and want to extract the IMAGE ID from it $ podman image ls | grep youtube-dl localhost/youtube-dl latest 2d4e37c4d609 3 hours ago 205 MB All I know piping ...
vrms's user avatar
  • 287
1 vote
2 answers
677 views

cmd pipe -> System cannot find specified path

Using cmd on Windows 10 Pro 21H2, when I try echo Hello | find "Bye" I get The system cannot find the specified path. Same thing if trying echo Hello | C:\Windows\System32\find.exe "...
Toni Homedes i Saun's user avatar
2 votes
2 answers
3k views

Is it possible to pipe qemu-img into SSH target?

I tried the following command, but only an empty file is created on the target and the command stays open qemu-img convert -f raw -O vmdk /dev/sda1 - | ssh foo@bar "cat > /home/foo/foobar.vmdk&...
mgutt's user avatar
  • 532
0 votes
2 answers
736 views

Piping nc to sed and evaluate datetime for each row

Could someone provide any idea, how could i pipe data from nc to sed (or awk, or anything) and evaluate and write to file a timestamp after each row? What i have: # cat /etc/systemd/system/ncserver....
M.Ch.'s user avatar
  • 3
0 votes
1 answer
849 views

How can wireshark.exe on windows read from a pcap file stream?

This is probably less a wireshark question and more a "how do I pipe a file into an application" on windows. On linux, I can capture a pcap file on another host with tcpdump and pipe it back ...
I grok it's user avatar
2 votes
1 answer
612 views

Linux shell: Pipe stderr and stdout to one file AND to individual files at the same time (using tee?)

I would like to form a pipe-stream that captures stdout to one file and stderr to another file AND both in a third file (so also the complete terminal output is in one file) somehow like this: process ...
user611005's user avatar
0 votes
1 answer
605 views

Linux does STDOUT | STDIN piping write data to disk?

I was planning on passing encryption keys to zfs load-key pool/set through stdin. The keys passed are generated by another program in HEX format and dataset is configured to have keylocation=prompt, ...
The amateur programmer's user avatar
0 votes
2 answers
360 views

nethogs -t | awk '{print $0}' return no output

nethogs is a linux process bandwidth monitoring tool. https://github.com/raboof/nethogs nethogs -t it's output looks like this. Refreshing: sshd: root@pts/0/4002/0 0.185156 0.0773437 unknown ...
The Unix Janitor's user avatar
0 votes
2 answers
5k views

Run a multiline bash script piped from stdin

I'm looking for a simple way to include multi-line scripts inline in documentation to make it transparent what each step does. This works echo "echo 1234" | bash So does this echo 'for N in 1 2 3; ...
Nanzikambe's user avatar
0 votes
0 answers
68 views

Is there any way to "stop following" in less without pressing Ctrl+C?

If I pipe the output of a long-running command to less, for example: foreman start | less -SR And I now press F to follow the output of foreman, is there any way to tell less to stop following, ...
Hubro's user avatar
  • 1,158
16 votes
3 answers
16k views

tee and assigning to variable?

I need to see output on the screen and at the same time grep the output and send grep result to variable. I think it can be done with tee but I can't figure out how exactly. I tried mycommand | tee ...
Putnik's user avatar
  • 2,347
0 votes
2 answers
399 views

re-parenting to screen two processes joined by pipe [duplicate]

Let's say in a PuTTY connection I start mysqldump --host host1 --databases db1 db2 db3 | mysql which creates two processes: mysqldump with PID 5800 and mysql with PID 5801. Is it possible to let the ...
user avatar
1 vote
1 answer
1k views

Mysqldump to compressed file

Situation: 1. mysql is backuped to disk with mysqldump (~250 GB) 2. dump is compressed with bpzip2 3. dump is moved to another DC 4. disk usage again in good state Problem: Filesystem usage peaks, ...
Damian's user avatar
  • 21
1 vote
2 answers
2k views

Send email if script outputs string

I found this line: sh script.sh | grep 'NO' 2>&1 > grep.log && /usr/bin/mail -s "grep found something" [email protected] < grep.log which will write the output of script.sh to grep.log ...
Kohjah Breese's user avatar
0 votes
1 answer
2k views

Command that returns exit code still returning 0 when using "command 2>&1 | tee -a /var/log/file.log"

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
Asdra's user avatar
  • 105
1 vote
3 answers
140 views

How to compress spaces in bash command output?

I work on a small screen and I'm trying to make the output of this command shorter, but I cannot get it to work. Command: docker container ls --all Output (too wide!): CONTAINER ID IMAGE ...
noctonura's user avatar
  • 463
0 votes
1 answer
2k views

Backuppc | Got fatal error during xfer (aborted by signal=PIPE)

I am running backuppc version 3.3.1 on an Ubuntu 16.04.5 LTS, I try to backup several Linux servers, almost Debian, ubuntu or proxmox hosts. My issue is that when I run the Full/Incermental backup ...
jerome winmedia's user avatar
0 votes
1 answer
359 views

Are bash pipes lazy or eager?

I was watching this command run tar cf - 20180412 -P | pv -s $(du -sb 20180412 | awk '{print $1}') | gzip > 20180412.tar.gz 9.02GiB 0:01:20 [ 114MiB/s] [============================================...
jperelli's user avatar
  • 233
0 votes
1 answer
710 views

set up master slave over ssh and port pipe for a Mysql replication

Everything started when I was asked to set up a syncing method for our Mysql server. Considering that I am a developer I got into deep waters first with DBA and now I found myself into SysAdmin. So I ...
Skaros Ilias's user avatar
1 vote
0 answers
225 views

dovecot/postfix/postgres and piping mail to script

I'm trying to pipe mail to script I added lines like these to /etc/postfix/master.cf: myscript unix - n n - - pipe flags=F user=root argv=/var/myscript/igotmail.sh ${sender} ${size} ${recipient} ...
zekorius's user avatar
2 votes
0 answers
733 views

stream a command's stdout, and merge with terminal's stdin to a single stdout

This answer shows numerous ways to stream multiple commands into another command, but since they use subshells you can't do stdin. While you can achieve this with named pipes, it's somewhat ugly and ...
J V's user avatar
  • 173
8 votes
2 answers
11k views

How to send text to stdin of docker container?

I have a docker container which runs a java program in foreground on startup. The java program listens to input on stdin. How can I programmatically send text to the java program? The container is ...
paolo's user avatar
  • 397
-1 votes
1 answer
429 views

dovecot thinks alias to pipe is a user, rejects email

I have an AWS EC2 instance running Amazon Linux with Postfix for serving mail. I have only local users -- no virtual users -- and my users and aliases are served via PostgreSQL. My aliases table in ...
pixelsandcode's user avatar
0 votes
2 answers
1k views

Large mysql dump pipe to s3

Is there any problem in doing this with lots of data? mysqldump ... | gzip | s3cmd put - s3://bucket/file.sql.gz The MySQL dump is about 100GB in size. What happens if gzip or s3cmd can't process ...
John W. Nesk's user avatar
1 vote
0 answers
362 views

Read named pipe as output to echoing to a pipe

I've created a few named pipes for a few client programs such as cec so I only need to make the connection once in the background and just pipe in commands. Most of the time I don't need to read the ...
Jason's user avatar
  • 11
3 votes
3 answers
1k views

Grep regex Stdout to telnet

I'm trying to use grep to get a regex result and pipe the results on-the-fly to telnet running an open port to a node server. The grep received continuous, but varied in interval, commands from a ...
kirgy's user avatar
  • 179
1 vote
1 answer
321 views

Can I filter output from `tail` with the `-f` flag?

I'd like to tail -f the output of access_log on RHEL 6.8 but pipe and grep that output to act as a filter. Is there such an option? That is I'd like live output from: # tail -f error_log | grep <...
Rick's user avatar
  • 309
1 vote
1 answer
2k views

gzip piped output into ssh command

I make backup over ssh like this: mysqldump -u dbuser -pXXXXXXXX dbname | ssh -i ~/.ssh/id_rsa_backup [email protected] 'cat > /var/backups/services/my_service/db/$(date +"%Y-%m-%d").sql' How ...
bux's user avatar
  • 636
2 votes
1 answer
2k views

Starting and stopping piped processes with Supervisor

I have a situation where I pipe the output of ffmpeg into a PHP script for some processing. I might have a few of these processes running at any given time and I figured to start and stop them I might ...
Luke's user avatar
  • 3,856
9 votes
2 answers
3k views

Cat, Grep, Redirect Output.... Blank File?

I just ran cat /opt/webapplications/Word/readme.log | grep -v 'Apple' and I got the output on the cli that I was expecting, which was all the lines in readme.log that did not contain 'Apple'... ...
Jeffrey L. Roberts's user avatar
1 vote
1 answer
415 views

How do I pipe stdout and std error to a file and back to stdout on Windows?

On Windows when running a batch script I want to record the output of I run: myprogram.bat 1> mylog.log 2>&1 Which is great - but I have to run a separate tail process to read the output ...
Hawkeye's user avatar
  • 2,739
0 votes
2 answers
749 views

Streaming stdout

I have a script that outputs a lot of debug data that I would like to avoid to save on disk (specially since the file system is on a flash memory card). So I run it on the background with nohup + &...
Sdlion's user avatar
  • 101
3 votes
1 answer
13k views

How to avoid "in use by another process" errors when piping output through a program?

In a Windows environment, are executable programs that are used to process piped output guaranteed to be unique tasks if called from different CMD environments? For example, suppose script1.cmd ...
tim11g's user avatar
  • 425
1 vote
1 answer
836 views

How to pipe a file being written to?

I have a binary file that is being written to continuously. I need to read the full content of that file to a pipe (either to nc or to a FIFO) and keep reading it while its is written (i.e. the ...
lvella's user avatar
  • 324
20 votes
5 answers
38k views

Unzip from stdin to stdout - funzip, python

The goal is to read a zip file from stdin and uncompress to stdout. Funzip works and is the solution I am looking for, the zip contains a single file, unfortunately funzip fails when the compressed ...
chillvibes's user avatar
-1 votes
1 answer
781 views

Cron: Execute python script, capture stdout & stderr and send via msmtp [duplicate]

I try this for almost 4 hours now, in different ways. I googled a lot, but nothing I try work as expected. I have a simple .msmtprpc file, that allows me to send mails like this: echo -e "Subject: ...
Yann's user avatar
  • 55
1 vote
1 answer
6k views

wget and pipe to tar in the background

I am trying to download a large file which is .tar.gz and (> 2GB) in size. The bash script also does lots of other things, so I want to kick off the download and then continue processing other ...
Justin's user avatar
  • 5,498
6 votes
2 answers
8k views

Apache errorlog piping fail

Trying to log to a central syslog server, either direct using Apache's ErrorLog to pipe to logger, or getting syslog to forward, but nothing is working and the errors are not making sense to me. I can ...
SysadminB's user avatar
1 vote
2 answers
1k views

How to pipe postfix into Codeigniter controller

I currently have postfix piping into a PHP script to process the email via an alias. catchall: |/var/www/vhosts/website/httpdocs/scripts/incoming_mail.php However, I wish to use the DB config etc ...
Jim Wright's user avatar
0 votes
0 answers
375 views

Remote packet capturing using fifo and dumpcap

I'm currently working on two linux servers where one server is running in 2.6.18-274.el5(Server A) and the second one in CentOS 7 (Server B). My requirement is to capture the packets of the network ...
BAdhi's user avatar
  • 121
5 votes
3 answers
3k views

Postfix - Pipe multiple recipient message as a single message

I am trying to pipe emails through Postfix to a Python script I have. Currently, messages with multiple recipients are piped to the script once for each recipient. I would like these messages to be ...
ctp_9's user avatar
  • 151
1 vote
1 answer
626 views

Postfix pipe mail at user level

I am trying to filter mail at the user level. I have CentOS and Postfix installed. I managed to install a filter on the server and its working great, except, instead of filtering by user, all emails (...
Nash's user avatar
  • 11
1 vote
1 answer
1k views

Pipe multiple files into one tar gz

I'd like to call mysqldump to create multiple backup files and then archive them in one tar.gz. I am following this tutorial on mysqldump part: http://dev.mensfeld.pl/2013/04/backup-mysql-dump-all-...
David162795's user avatar
0 votes
2 answers
437 views

Unzip piping order

I have a file, foo.zip which looks something like this: foo.zip -- fileA.txt -- fileB.txt I can pipe the output of the extracted files like this: unzip -p foo.zip *.txt | something My problem is ...
Grav's user avatar
  • 115