The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
18 views

Why doesn't this tee with process substitution produce the 1st and chosen lines? [duplicate]

What I want is printing the output the first line ( table head ) of ps aux and the grep result. After search, I come up with following. ps aux | tee >(head -1 > /dev/tty) | grep mongo But I ...
0
votes
1answer
41 views

Using tee or pipe to log console output will cause my program not to start [duplicate]

I'm running hostapd on my raspberry PI to let it function as an accesspoint. It's working fine with the following command: sudo hostapd /etc/hostapd/hostapd.conf This will start hostapd and log all ...
0
votes
1answer
19 views

Keep PHP's output with tee -a

Normally when running PHP script in web server mode, this would show up: $ php -S 0.0.0.0:12345 PHP 5.6.1 Development Server started at Mon Nov 24 14:09:22 2014 Listening on http://0.0.0.0:12345 ...
1
vote
1answer
46 views

Redirect output to stdout and pipe to a binary

I have a nice PS1 line in my .bash_profile, and I want to copy it to another machine. So I want to view it AND copy it to my clipboard. I can't figure out how to string the commands to do this ...
1
vote
2answers
49 views

Append a file, output to screen and redirect from stderr all at once, without tee

I'm running a time dd command in a shell script, and I'd like to output the results to a file, and print it out on the screen. The line that I'm currently running is: (time dd of=$dest_filepath ...
2
votes
2answers
30 views

How to write to a file with netcat? And set it to grow to a certain size and begin overwriting itself?

I'm currently writing a program that prints to a Zebra printer. Because my office doesn't have a zebra printer, we print to a linux VM running netcat with nc -k -l -p 9100 | tee labels.txt so that we ...
1
vote
0answers
37 views

Verbose output in logfile and simple output on screen?

Let's say I have the following script: script.sh and i want the verbose output in a logfile and simple output on screen. Logfile should contain the csh -v script.sh output, and on the screen should ...
1
vote
0answers
16 views

Test execution output of a command before a pipe [duplicate]

I would like to test the execution of a php script that redirect its stdout and stderr to a file with tee. php /path/to/script --param 2>&1 | tee -a /path/to/log if ( test $? -ne 0 ); then ...
1
vote
2answers
797 views

Using exec and tee to redirect logs to stdout and a log file in the same time [duplicate]

In a bash script, how can I redirect all standard outputs to a log file and tee the output on the screen using exec ? log_file="$HOME/logs/install.txt-`date +'%Y-%m-%d_%H-%M-%S'`" [ -f "$log_file" ] ...
8
votes
2answers
297 views

Redirecting output depending on grep regex

I am using gradle run to start a REST server. The output of the REST server looks like this: XXX.XXX.XX.XXX - <moreinfo> randomtext randomtext XXX.XXX.XX.XXX - <moreinfo> XXX.XXX.XX.XXX - ...
2
votes
1answer
517 views

bottomless tee?

I was just playing around in the terminal and I did this: printf 'some string\n' | { tee /dev/fd/3 | { : && sed 's/some/string/' } } 3>&0 I was really surprised when ...
2
votes
2answers
135 views

Process substitution with tee and paste

I'm trying to pipe a command through the output of two other commands and then merge the results of the two process substitutions. An example that gets me close is: command | tee >(sed -rn ...
1
vote
2answers
94 views

grep a keyword from Mplayer output and send the rest to file

I am using mplayer. I want to send everything to a log file (/tmp/server.log), but I want the Volume output to be written to the terminal. I have seen that there is a way to split the output with tee, ...
4
votes
2answers
150 views

Running several times the same command with several aguments after a pipe

I have a key (of random binary data) that gets generated by get_key. And with this key, I can do several things with my encrypted files. For example, I can decrypt them. get_key | tee >(decrypt ...
1
vote
0answers
33 views

Filter partial output of some script [duplicate]

I need to analyze the output of some script So, I know their header and their tail of some part of the output script, but not the content. I found an approach [1] But I need something like: $ ...
11
votes
3answers
987 views

tee stdout to stderr?

I'd like to send stdout from one process to the stdin of another process, but also to the console. Sending stdout to stdout+stderr, for instance. For example, I've got git edit aliased to the ...
3
votes
2answers
110 views

tee / sudo password cache conflict?

I have a large bash script (Ubuntu 12.04). The script is designed to be invoked by a regular user; only certain commands within the script run with sudo. It is not an option to run the entire script ...
3
votes
4answers
159 views

saving output of another command

I need to select certain lines from the log file and also save them to a text file. I tried the following but none of them are working as expected. The file "todel.txt" shows 0 bytes. tail -f ...
2
votes
1answer
344 views

Logging interactive input and output without capturing all typed input and control characters

I am trying to log output from an interactive command-line program; units, specifically. I have tried using tee like this: units | tee units.log or script like this: script -c units units.log ...
4
votes
3answers
1k views

How to get mplayer to play from stdin?

Why doesn't this work? cat /dev/video1 | mplayer - If I could get that to work, then I could play & record video at the same time using 'tee' to feed mplayer and mencoder. I want to play live ...
0
votes
2answers
96 views

Why does this command work for logging script output?

This command does not store the output of my script in the log file: . myscript.sh | tee -a log_file.log However this next command does store the output in the log file. . myscript.sh 2>&1 ...
5
votes
2answers
309 views

Reusing pipe data for different commands

I would like to use the same pipe for different applications, like in: cat my_file | { cmd1 cmd2 cmd3 } Cmd1 should consume part of the input. Cmd2 should consume another part and so on. ...
0
votes
1answer
802 views

Use sudo tee with heredoc to append to existing file

From Generate script in bash and save it to location requiring sudo we have this method, which I like: sudo tee "$OUTFILE" > /dev/null <<'EOF' foo bar EOF However, I would like to use that ...
4
votes
1answer
629 views

How can I use tee and logger -t “some tag:”?

I've seen in another post which shows how to use tee and logger as shown below. tee >(logger) <<< "System Load is OK : $Current_loadadv" >(logger) is bash syntax to create a file ...
3
votes
2answers
201 views

How to duplicate a stream and process both parts in a streaming way?

Sometimes I want to insert something in a pipeline for reporting or some other secondary use. It might be as simple as wc -l, or a more complex beast like awk or even a python script. It'd be nice to ...
0
votes
1answer
594 views

Why doesn't this variable assignment work when using tee?

Consider: $ FILE_NAME=`(cat somefile | head -1)` | tee -a dump.txt $ echo $FILE_NAME $ Now, why doesn't the output of (cat somefile | head -1) reach the standard input of tee ..? If the output ...
5
votes
3answers
3k views

Output to stdout and at the same time grep into a file

I have a script that outputs text to stdout. I want to see all this output in my terminal, and at the same time I want to filter some lines and save them in a file. Example: $ myscript Line A Line B ...
8
votes
3answers
2k views

tee + cat: use an output several times and then concatenate results

If I call some command, for instance an echo I can use the results from that command in several other commands with tee. Example: echo "Hello world!" | tee >(command1) >(command2) ...
2
votes
1answer
293 views

How to `tee` dropping all CR lines only in the file but not stdout?

When using e.g. rsync, I'd like to tee its output such that I can both view the current progress live, and have a log for later. Using just piping | tee logfile the logfile will contain many lines à ...
1
vote
2answers
639 views

Print/Tee to console without passing output to pipe

Is there a way to print or tee one thing to the console and still pass something else through to the next pipe? Something like: echo dog | printOrWhatnot "PUTTING MY THING DOWN" | sed 's/dog/cat/g' | ...
4
votes
3answers
2k views

How do I use tee to redirect to grep

I don't have much experience of using tee, so I hope this is not very basic. After viewing one of the answers to this question I came across a strange beheviour with tee. In order for me to output ...
3
votes
1answer
1k views

Write data to both a file and a serial port — can I use tee?

I am trying to take the input from a serial port and write it to a file and also then read the file and send it back out the serial port to the host computer. A coworker suggested using the "tee" ...
5
votes
2answers
642 views

Wrapping a shell script with tee

There is a bash script which prints some logs and allows some arguments. The script prints the logs to STDOUT. Let's say the script's name is AAA.sh I'd also like to make the script to print the logs ...
4
votes
2answers
535 views

how to redirect terminal output to multiple log files

I've been trying redirect output to logfiles but should NOT be displayed on terminal, but following command does output both on terminal and in logs. Any ideas are appreciated. (some_cmd | tee -a ...
3
votes
2answers
4k views

how to redirect output to multiple log files

How to redirect standard output to multiple log files Following seems to be not working. Any help is appreciated. some_command 1> output_log_1 output_log_2 2>&1
3
votes
2answers
631 views

Different redirection styles with netcat and tee giving different results

In trying to trace a simple HTTP GET request and its response with nc, I'm running into something strange. This, for example, works fine: the in file ends up containing the HTTP GET request and the ...
4
votes
1answer
292 views

command like wc but with tee behaviour

I want to backup a database using psql and COPY command. here is my script: psql "user=${USERNAME} host=${HOSTNAME} dbname=${DBNAME} password=${PASSWORD}" -c \ "COPY (SELECT * FROM tbl) ORDER BY id ...
0
votes
1answer
398 views

Bash script doesn't TEE output to subdirectory

I've got a script that runs a number of curl commands by reading an input file line by line (each line has different curl parameters). I'm trying to tee the stnd out and stnd error of the curl ...
12
votes
3answers
850 views

How can I redirect matching lines to a file, and non-matching lines to a different file?

Is there a script/program/utility already available for the following requirement in a optimised way? someCommand | tee >(grep "pattern" > LinesWhichMatch) | grep -v "pattern" > ...
5
votes
1answer
576 views

Is it possible to “fork” STDOUT to two different locations? [duplicate]

Possible Duplicate: Is there a way in bash to redirect output and still have it go to stdout? Let's say I do: ps -ef | grep httpd to see if apache is running or not, but I also want to ...