Questions tagged [pipe]

157 questions
11
votes
1 answer

How to concatenate streams?

I know cat can concatenate files, but I need to concatenate a mix of files and streams and pipe the result to another process. To make the question more concrete, I want to concatenate cat abc.sql together with gzip -dc xyz.sql.gz and cat qvf.sql…
rustyx
  • 1,676
  • 3
  • 21
  • 30
9
votes
2 answers

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'... Next I ran... cat /opt/webapplications/Word/readme.log…
9
votes
5 answers

how to pipe a mysql dump to s3cmd

I want to transfer a mysql dump, compressed, to s3. I tried: mysqldump -u root -ppassword -all-databases | gzip -9 | s3cmd put s3://bucket/sql/databases.sql.gz but then I get: ERROR: Not enough paramters for command 'put' How can I do this (in one…
zensys
  • 319
  • 3
  • 9
  • 19
8
votes
5 answers

Grep-ing gzipped files

I have a set of 100 log files, compressed using gzip. I need to find all lines matching a given expression. I'd use grep, but of course, that's a bit of a nightmare because I'll have to unzip all files, one by one, grep them and delete the unzipped…
Julien Genestoux
  • 609
  • 8
  • 19
8
votes
1 answer

using temporary files vs pipes advantages and disadvantages

Say I have a file named jobs.csv and I would like to get the top 50k jobs done by Foo I can either do: # cat jobs.csv | sort -u | head -n 50000 > /tmp/jobs.csv # cat /tmp/jobs.csv | while read line; do Foo --job=$line; done Or # cat jobs.csv | sort…
Tzury Bar Yochay
  • 727
  • 11
  • 24
7
votes
2 answers

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 started with -it, so I can docker attach…
paolo
  • 387
  • 3
  • 14
7
votes
8 answers

Redirect all incoming mail into a script

I have no idea about Mail Delivery. but i need redirect ALL incoming e-mail (*@mydomain.com) into an a php script. i'm using debian Exists a simple mail server to do this? (without exim, postfix, etc) i only need redirect all mail request. if this…
felix46r
  • 261
  • 1
  • 5
  • 8
7
votes
6 answers

Changing files on the fly in Linux (writing to input file on a pipe)

How to change a file on the fly along a pipe? I'm probably looking for a way to buffer a file at the beginning of a pipe, which in contrast to this: cat foo.txt | grep bar > foo.txt ... would preserve the input data from destruction by the pipe…
Alex
  • 2,357
  • 5
  • 32
  • 41
6
votes
2 answers

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 get the Custom log to work, but not ErrorLog.…
SysadminB
  • 71
  • 1
  • 6
6
votes
2 answers

postfix pipe to script: execvp permissions denied error

I am new to postfix and am trying to pipe a message to a particular email address to a bash script. I am running CentOS 6 in case that matters. My script has 777 permission (for testing), and when I email to the test account I see that postfix…
TSG
  • 1,674
  • 7
  • 32
  • 51
6
votes
2 answers

Why is this tee losing stdout?

Simple script: #!/bin/bash remote_ssh_account="depesz@localhost" directory_to_tar=pgdata exec nice tar cf - "$directory_to_tar" | \ tee >( md5sum - | \ ssh "$remote_ssh_account" 'cat - > /tmp/h3po4-MD5-2012-03-13.tar' ) | \ …
user13185
6
votes
5 answers

Bash: Execute piped lines from stdin

I haven't found a solution to this after some searching. I think the search terms are just too general. I'd like to know how to execute a number of lines (at the bash prompt) which are generated by some other source. For example, I have a Python…
SabreWolfy
  • 368
  • 1
  • 2
  • 13
5
votes
3 answers

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 piped to the script just once regardless of the…
ctp_9
  • 151
  • 1
  • 4
5
votes
2 answers

Piping in postfix/aliases

Possible Duplicate: How to configure postfix to pipe all incoming email to a script? I'm having problems setting up simple piping for Redmine (or '|cat > /tmp/temp') /etc/postfix/virtual: support@myhost.com support /etc/postfix/aliases: support:…
simendsjo
  • 304
  • 2
  • 14
5
votes
3 answers

Bash command for regular expression substitution

What bash command can be used for regex substitution on a pipe? cat foo.txt | someprogram
Alex
  • 2,357
  • 5
  • 32
  • 41
1
2
3
10 11