The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
733 views

pipe multiple files, single ssh connection, remote commands

I'd like to pipe several files to a remote server, piped as input to commands run on the remote server, over ssh, but only one ssh connection/command is permitted. (In the remote authorized_keys file, ...
0
votes
1answer
902 views

Why is this apache php piped log script not working properly?

i have a piped logging program like this: #!/usr/bin/php <?php $fd = fopen("php://stdin", "r"); while(true) { $l = fread($fd,8192); $l = trim($l); if($l =="") continue; ...
6
votes
1answer
596 views

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 ...
5
votes
2answers
2k views

How can I handle spaces in file names when using xargs on find results?

One of my common practices is to perform greps on all files of a certain type, e.g., find all the HTML files that have the word "rumpus" in them. To do it, I use find /path/to -name "*.html" | xargs ...
3
votes
0answers
622 views

DSGET escapes hash signs (#) in outputted Distinguished Names (DN)s but expects unescaped hash signs for input

Lets say I want to do the very simple query in AD dsquery user -name "John Smith" | dsget user -memberof -expand This will output the DNs of the AD groups that this user belongs to. I can make it ...
0
votes
3answers
447 views

how to “batch” output of “tail -F” or output all data in a stream every X seconds?

I am trying to monitor a log file in real-time. Say I issue a command such as: tail -F mysystem.log|grep -i error|mail ... This is supposed to monitor my log file, every time it sees an error, email ...
0
votes
2answers
76 views

Piping emails from a development server to a text file

Is there a way to capture all mail from a unix server and pipe it to a log file? Or maybe at least all mail from PHP? I know of a trick where in php.ini sendmail is tricked byt this line: ...
0
votes
2answers
345 views

How pipe email to PHP with Maildirs

I used to pipe incoming emails using: |/path/to/php/script in .forward file at /home folder. But the actual system I'm working on is based on Maìldir instead MBOX. So that solution does not work. I ...
1
vote
1answer
105 views

receiving two emails to virtual alias

have a virtual alias setup in /etc/postfix/virtual that reads: @mydomain.com mydomainincoming I then have a pipe setup in /etc/aliases that reads: mydomainincoming: ...
0
votes
3answers
1k views

forward all mail on a specified domain to script

Hey all! I run a disposable e-mail service that accepts all incoming mail and forwards it to a PHP script that stores it in a database for people to view. Before now, I have been on shared hosting ...
10
votes
3answers
799 views

On Linux, how can I see how far through a file a process is?

If I have a piped command such as cat myfile | processor_application where processor_application is something reading from standard in, in chunks, to process, is it possible to see how far ...
5
votes
3answers
2k views

Redirect output of mysqldump to scp

I worked with a linux pro years ago who did this nifty trick. He could do a mysqldump but redirect the output to an scp/ssh connection rather than writing to disk. We utilised this quiet a bit where i ...
0
votes
1answer
727 views

How do I copy stdout and stderr into a log file in Windows XP?

I have a script that I'm running from a command line. I want the stdout and stderr to be displayed on the screen and also to be copied into a logfile with append. What is the syntax for this ...
2
votes
2answers
519 views

Bash Parallelization of CPU-intensive processes

tee forwards its stdin to every single file specified, while pee does the same, but for pipes. These programs send every single line of their stdin to each and every file/pipe specified. However, I ...
0
votes
3answers
724 views

Hang and broken pipe when rebooting over ssh

I'm trying to reboot one box from another, using the following command: ssh 10.0.0.26 'reboot --force' I expect this to block for a short while until the other box reboots, then return. What I see ...
3
votes
1answer
622 views

Capturing STDERR and STDOUT to file using tee

I'm unclear what the best order is to capture both STDERR and STDOUT to the same file using tee. I know that if I want to pipe to a file I have to map the filehandle after the redirect, i.e. find . ...
1
vote
4answers
843 views

Is there an easy way to insert data/time in front of a log file with just shell scripting?

Say I want to monitor memory usage on a java process overnight. I can do something like top | grep java > out.log I will get a log file with a whole bunch of lines. Is there an easy way to get a ...
0
votes
1answer
124 views

How to display results without two first lines

When I run some bash command it returns 2 .. n lines of text (n is different each time, may contain blank lines). How to filter the output to display the result skipping lines 1 and 2? e.g. $ ...
1
vote
1answer
578 views

Non-blocking bash redirection

Does anyone know how to redirect the output of a program, running from a bash script, to a named pipe IN NON BLOCKING MODE (having 'O_NONBLOCK' flag set)?
0
votes
1answer
1k views

Is there any limit to AIX 5.3 pipe size?

I'm in trouble while performing cat/tail/head operation on large files on Aix 5.3. When asking for a cat of several 1Go file redirected to another one: cat file1 file2 file3 > outputfile The ...
1
vote
1answer
256 views

sed can't find a file that obviously exists

I run the following command which comments out all lines that contain the text "dlclose" grep -lIR "dlclose" . | grep -v ".svn" | xargs sed -i "s/.*dlclose.*/\/\/&/g" However, sed claims that ...
1
vote
1answer
278 views

Comment all lines matching some pattern

I need to comment out all lines containing "dlclose" for each file in the current directory and any sub-directories (recursively). This is my best guess so far given what I was able to find out from ...
2
votes
2answers
373 views

Pipe email from google apps to server php script

I'm wondering if anyone here would have any ideas on how I can pipe support@domain.com to our ticket system on our server with our email being hosted via Google Apps. Is it possible to pipe a ...
1
vote
3answers
2k views

Scripting (piping) commands into a telnet session

i use a cronjob to execute a filetransfer to a host and then telnet into the host and pipe some commands into it. HOST=somehost USER=postgres PASSWD=blabla ftp -n -v $HOST <<END_SCRIPT quote ...
1
vote
2answers
284 views

Top like viewer eating tail -f stream

Hi there I'm searching for a command line tool working with a stream of lines (tail -f typically) and counting them like : tail -f /var/log/apache2/access.log | cut -d' ' -f1 | SOME_COMMAND and ...
0
votes
1answer
174 views

how to check open ports of bunch of website at once with nmap/linux?

I want to use nmap in such a way that I could check bunch of server's port at once for checking whether their particular port is open or not? right now I have 10 ip addresses but in future this could ...
0
votes
1answer
190 views

Does Apache spawn piped logger on each HTTP request?

I am examining a high-volume Apache prefork site and noticing that many log entries such as: CustomLog '|/foo/bar/cronolog -foo -bar' RewriteLog '|/foo/bar/cronolog -bar -foo' When apache logs the ...
4
votes
4answers
139 views

Is there a *Nix tool that can be used to format command output that is too wide for the screen?

I'm running psql -U postgres template1 -c "select * from pg_stat_activity" and the output is too wide for my terminal. Is there a *nix command I can use to prevent the output from wrapping? ...
1
vote
8answers
8k views

PsExec and Remote Environment Variables, Logging, Etc

When I run PsExec on a remote computer, I always fall short of what I want. What I would like ideally in most situations is a) a log on an admin server where each individual log has the name of each ...
1
vote
1answer
270 views

Exim 4 pipe select command/script from mysql db

Is there an option to run a mysql lookup in the pipe driver of exim? MYSQL_Q_SCRIPT=SELECT script FROM MYSQL_EMAILTABLE WHERE domain='${quote_mysql:$domain}' AND ...
4
votes
1answer
442 views

Delete a directory with pipe (|) in its name?

Without booting to Linux, how do you delete a directory that was created in Linux on an NTFS partition that contains a pipe in the file name? For example: ...
2
votes
2answers
244 views

Pipe program output into a protected file using sudo

I want to do the following: $ echo "secrets" > protected_file But the the problem is, I don't have file permissions for "protected_file", so I try the following: $ sudo echo "secrets" > ...
1
vote
2answers
2k views

Updating a file in a zip archive from STDIN

I want to update/freshen a file in a zip archive with the contents of stdin. So far I haven't been able to find a way to tell the zip command that the contents of stdin correspond to a particular ...
0
votes
3answers
1k views

Count number of bytes piped from one process to another

I'm running a shell script that pipes data from one process to another process_a | process_b Does anyone know a way to find out how many bytes were passed between the two programs? The only ...
0
votes
3answers
1k views

Bash piping answer in Ubuntu

In a bash script, I want to know know how to pipe in answers like for example: ssh -l username -i /home/ubuntu/.ssh/id host.com < yes The ssh connection would ask if I would like to continue the ...
1
vote
1answer
2k views

How to ask exim4 to redirect some email pattern to a specific email address?

I would like to redirect all email from *@domain.fr to username@gmail.com Do you know how I can configure my exim4 server on Debian to do so ? (My exim configuration seams to be split in different ...
1
vote
2answers
1k views

FreeBSD Traffic Shaping

I'm trying to do traffic shaping with FreeBSD, here are my rules su-3.2# ipfw show | grep pipe 08380 1514852 125523804 pipe 1 tcp from any to any dst-port 80 su-3.2# ipfw pipe 1 show 00001: 2.000 ...
1
vote
7answers
2k views

Running script in background without sticking to shell

i want to run a shell script remotely via ssh and the ssh shell should end when the script ends. The script itself runs another script whose output is piped to a log file. Example: I run the script ...
15
votes
4answers
13k views

How to pipe stderr without piping stdout

How do I pipe the standard error stream without piping the standard out stream? I know this command works, but it also writes the standard out. Command 2>&1 | tee -a $LOG How do I get ...
2
votes
2answers
2k views

Why is my apache log missing information?

I have a SSL-enabled Apache server which utilizes rotate log to archive the log files. The problem is that when the logs are "rotated", some information get lost... For example, all authenticated ...
0
votes
5answers
2k views

How to recursively search and replace from command line on unix/linux system

So I want to change several files at one with one command. This is what I have so far: find -regex ".*\.ext$" | xargs grep -l searchText 2> /dev/null | xargs -i sed 's/searchText/replaceText/' ...
0
votes
6answers
1k views

How to run command on parts of input file

I have ~ 40GB file, and a filter command that for some reason breaks when I try to run it on the file (even when passed via pipe). But. It doesn't fail when I split input file into many small files, ...
14
votes
3answers
7k views

How can I get more info on open pipes show in /proc in Linux?

In Linux if you go digging in /proc/<pid>/fd often you'll see output like: lrwx------ 1 root root 64 Jul 30 15:14 0 -> /dev/null lrwx------ 1 root root 64 Jul 30 15:14 1 -> /dev/null ...
4
votes
5answers
830 views

Looping a command over a list of arguments in Linux

How to execute the same command with arguments that are delivered by another command via pipe? As a result of the extraction of file names from a source I get: $some_command filename1 ...
-1
votes
1answer
913 views

Piping Mail with Exim: Only Works Locally

Whenever I send an email to my catchall alias via SSH (i.e., locally), Exim successfully pipes the e-mail to a PHP script, as I told it to do. However, when I try to send an e-mail to my catchall ...
0
votes
1answer
956 views

Catchall with Exim and Virtual Host

I tried following the tutorial at: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html to pipe incoming mail to a PHP script for a virtual host with Exim. I can't seem to get it ...
5
votes
6answers
1k views

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 ... ...
23
votes
7answers
14k views

Unzipping files that are flying in through a pipe

Can I make unzip or any similar programs work on the standard output? The situation is I'm downloading a zip file, which is supposed to be unzipped on the fly. Related issue: ...
11
votes
5answers
13k views

How do I pipe a downloaded file to standard output in bash?

How is it possible to pipe out wget's downloaded file? If not what alternatives should I use? UPD: Thanks all for your answers, I managed to tune my downloader (curl) to send files to stout. However ...
5
votes
3answers
2k views

Bash command for regular expression substitution

What bash command can be used for regex substitution on a pipe? cat foo.txt | someprogram