10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
OS version: RHEL 7.4
Shell : bash
I would like to capture command outputs using tee like # yum upgrade | tee yumupgradeLog
But, if I use tee command, I cannot respond to prompts like Is this ok : during command execution as shown below.
Is there a way I could use tee and still be able to... (4 Replies)
Discussion started by: kraljic
4 Replies
2. Shell Programming and Scripting
Hello All,
I have a requirement to redirect stdout and stderr to 'log' file and stderr alone to 'err' file.
Can someone please help me with this?
Thanks in advance (2 Replies)
Discussion started by: vikas_trl
2 Replies
3. Shell Programming and Scripting
I have the following script as shown below where I cat a file and then also tee the output to a file as I have to email the execution of the process to users at the end of the script:
cat incoming.dat | tee -a execution.log
if
then
echo "Issue with incoming.dat file, file not... (5 Replies)
Discussion started by: calredd
5 Replies
4. UNIX for Dummies Questions & Answers
for i in /tmp/*filex*; do echo $i |sed 's/\/tmp/infofiles\/infosize\/db\/files\///g';done 2>&1 |tee>output
|
The script works fine, but I cannot get the output to go to the screen and output at same time. I've tried tee -a tee and a number of commands but the only way I can get it working is... (3 Replies)
Discussion started by: newbie2010
3 Replies
5. Shell Programming and Scripting
In the current directory , I have seven files .
But when I use the following command , it lists eight files ( 7 files + file_list.xtx)
ls -1 | tee file_list.xtx | while read line; do echo $line ; done
Does the tee command create the file_list.xtx file first and then executes the ls -1... (1 Reply)
Discussion started by: kumarjt
1 Replies
6. UNIX for Advanced & Expert Users
Hi,
Want to log the output of command & check the exit status to find whether it succeeded or failed.
> ls abc
ls: abc: No such file or directory
> echo $?
1
> ls abc 2>&1 | tee log
ls: abc: No such file or directory
> echo $?
0
Tee commands changes my exit status to be always... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies
7. Shell Programming and Scripting
script1:
#!/bin/ksh
more test.txt
script2: calling the script1
#!/bin/ksh
/tmp/script1.sh 2>&1 | tee tee.log
where test.txt contains ~1200 lines.
When I execute the script2 the more command does not print pagewise it goes to the end of the line, when I remove the tee command it... (4 Replies)
Discussion started by: prasad111
4 Replies
8. UNIX for Dummies Questions & Answers
Hello
If anybody knows something about the following please help me.
I am using HP unix.
In a script called test.txt i have the following command
echo ok | tee test1.txt
It works fine.It prints ok on the screen and creates the file test1.txt and puts in the file the "ok".
In the same... (2 Replies)
Discussion started by: kostasch
2 Replies
9. UNIX and Linux Applications
cat work.txt
M|324324|32424|3431
M|324324|32424|3431
N|324324|32426|3432
N|324324|32424|3434
M|324324|32424|3435
cat work.txt | tee $( grep '^M' > m.txt ) | $( grep '^N' > n.txt )
cehpny00:/home01/sr38632 $ cat m.txt
M|324324|32424|3431
M|324324|32424|3431
M|324324|32424|3435
... (2 Replies)
Discussion started by: rsampathy
2 Replies
10. Shell Programming and Scripting
Hi,
I would like to process, filter the same ASCII asynchronous live data stream in more than one pipe pipeline.
So the one pipeline should filter out some records using grep key word
and more than one pipes pipelines
each should grep for another key words, each set seperately for each... (5 Replies)
Discussion started by: jack2
5 Replies
Tee(3pm) User Contributed Perl Documentation Tee(3pm)
NAME
IO::Tee - Multiplex output to multiple output handles
SYNOPSIS
use IO::Tee;
$tee = IO::Tee->new($handle1, $handle2);
print $tee "foo", "bar";
my $input = <$tee>;
DESCRIPTION
"IO::Tee" objects can be used to multiplex input and output in two different ways. The first way is to multiplex output to zero or more
output handles. The "IO::Tee" constructor, given a list of output handles, returns a tied handle that can be written to. When written to
(using print or printf), the "IO::Tee" object multiplexes the output to the list of handles originally passed to the constructor. As a
shortcut, you can also directly pass a string or an array reference to the constructor, in which case "IO::File::new" is called for you
with the specified argument or arguments.
The second way is to multiplex input from one input handle to zero or more output handles as it is being read. The "IO::Tee" constructor,
given an input handle followed by a list of output handles, returns a tied handle that can be read from as well as written to. When
written to, the "IO::Tee" object multiplexes the output to all handles passed to the constructor, as described in the previous paragraph.
When read from, the "IO::Tee" object reads from the input handle given as the first argument to the "IO::Tee" constructor, then writes any
data read to the output handles given as the remaining arguments to the constructor.
The "IO::Tee" class supports certain "IO::Handle" and "IO::File" methods related to input and output. In particular, the following methods
will iterate themselves over all handles associated with the "IO::Tee" object, and return TRUE indicating success if and only if all
associated handles returned TRUE indicating success:
close
truncate
write
syswrite
format_write
formline
fcntl
ioctl
flush
clearerr
seek
The following methods perform input multiplexing as described above:
read
sysread
readline
getc
gets
eof
getline
getlines
The following methods can be used to set (but not retrieve) the current values of output-related state variables on all associated handles:
autoflush
output_field_separator
output_record_separator
format_page_number
format_lines_per_page
format_lines_left
format_name
format_top_name
format_line_break_characters
format_formfeed
The following methods are directly passed on to the input handle given as the first argument to the "IO::Tee" constructor:
input_record_separator
input_line_number
Note that the return value of input multiplexing methods (such as "print") is always the return value of the input action, not the return
value of subsequent output actions. In particular, no error is indicated by the return value if the input action itself succeeds but
subsequent output multiplexing fails.
EXAMPLE
use IO::Tee;
use IO::File;
my $tee = new IO::Tee(*STDOUT,
new IO::File(">tt1.out"), ">tt2.out");
print join(' ', $tee->handles), "
";
for (1..10) { print $tee $_, "
" }
for (1..10) { $tee->print($_, "
") }
$tee->flush;
$tee = new IO::Tee('</etc/passwd', *STDOUT);
my @lines = <$tee>;
print scalar(@lines);
AUTHOR
Chung-chieh Shan, ken@digitas.harvard.edu
COPYRIGHT
Copyright (c) 1998-2001 Chung-chieh Shan. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
perlfunc, IO::Handle, IO::File.
perl v5.12.3 2001-03-10 Tee(3pm)