04-14-2011
You want the tee command.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi friends
I am facing one problem while redirecting the out of the stderr and stdout to a file
let example my problem with a simple example
I have a file (say test.sh)in which i run 2 command in the background
ps -ef &
ls &
and now i am run this file and redirect the output to a file... (8 Replies)
Discussion started by: sushantnirwan
8 Replies
2. Shell Programming and Scripting
Is there a way to redirect all stdout to a file implicitly - like defining stdout=/home/me/process.log - so that all "echo" commands in several scripts/subscripts are written to that file; instead of having to edit all scripts to redirect the "echo" (e.g. echo 'This is a test ' >>... (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies
3. Programming
Hello! I want to post a question. does anybody know how to print the output of a C program both in stdout and a file??
thanx (8 Replies)
Discussion started by: nicos
8 Replies
4. Shell Programming and Scripting
working on a c sell script
I think I understand the concept of it, which is:
filename >> file.txt (to appaend)
or filename | tee -a file.txt (to append)
The problem is that my shell script is used with several parameters, and these commands don't seem to work with just filename. They... (2 Replies)
Discussion started by: mistermojo
2 Replies
5. Shell Programming and Scripting
Is there a way to alter the file descriptor for stdout.?
sample:
#!/bin/ksh
exec 1>file
exec 2>file
echo hi --------->This will go to file
print -u4 "come statement"---->I want to make the file descriptor 4 to point to stdout.
The reason is ,I have a script which has lot of db2... (1 Reply)
Discussion started by: prasperl
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Does anyone know if there is an unzip command similar to
tar -xOf $tarBall $fileInTarFile
which will untar a single file in a tar ball to STDOUT ?
I want to do the same but with a .zip (ZIP archive) file.
- Andy
---------- Post updated at 05:56 PM ---------- Previous update... (0 Replies)
Discussion started by: andyatit
0 Replies
7. Programming
I originally wrote my script using the korn shell and had to port it to bash on a another server. My script is working find for backing up but noticed that now after the move, I am not getting any output to my log files.
Using Korn shell, this worked for me for some odd reason. This was sending... (2 Replies)
Discussion started by: metallica1973
2 Replies
8. Shell Programming and Scripting
I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Discussion started by: igurov
3 Replies
9. Shell Programming and Scripting
I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file.
I have searched in this formum for a solution, but something like
srcipt 3>&1 >&2 2>&3 3>&- | tee errs
doesn't work for me...
Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies
10. Shell Programming and Scripting
I cannot figure out what is wrong.... I have 3 files with IP addresses:
file1 134.123.3.236
file2 134.123.3.235
file3 134.123.5.237
I type "prob1 Oops x2x3x4". Then my code creates file with name Oops and first line x2x3x4. Moreover, my code generate IP and it gives to file Oops as a second... (1 Reply)
Discussion started by: Manu1234567
1 Replies
LEARN ABOUT OPENSOLARIS
tee
tee(1) User Commands tee(1)
NAME
tee - replicate the standard output
SYNOPSIS
/usr/bin/tee
/usr/bin/tee [-ai] [file]...
ksh93
tee [-ail] [file]...
DESCRIPTION
/usr/bin/tee
/usr/bin/tee copies standard input to standard output, making a copy in zero or more files. tee does not buffer its output. The options
determine if the specified files are overwritten or appended to.
ksh93
The tee built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when tee is executed without a pathname prefix and
the pathname search finds a /bin/tee or /usr/bin/tee executable.
tee copies standard input to standard output and to zero or more files. The options determine whether the specified files are overwritten
or appended to. The tee utility does not buffer output. If a write to a file fails, tee continues to write to other files although it exits
with a non-zero exit status.
The number of file operands that can be specified is limited by the underlying operating system.
OPTIONS
/usr/bin/tee
The following options are supported by /usr/bin/tee:
-a Appends the output to the files rather than overwriting them.
-i Ignores interrupts.
ksh93
The following options are supported by the tee built-in command in ksh93:
-a Appends the output to the files rather than overwriting them.
--append
-i Ignores SIGINT signal.
--ignore-interrupts
-l Sets the standard output to be line buffered.
--line-buffer
OPERANDS
The following operands are supported:
file A path name of an output file. Processing of at least 13 file operands are supported.
USAGE
See largefile(5) for the description of the behavior of tee when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of tee: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
/usr/bin/tee
The following exit values are returned by /usr/bin/tee:
0 The standard input was successfully copied to all output files.
>0 The number of files that could not be opened or whose status could not be obtained.
ksh93
The following exit values are returned by tee in ksh93:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
/usr/bin/tee
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|Standard |See standards(5). |
+-----------------------------+-----------------------------+
ksh93
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |See below. |
+-----------------------------+-----------------------------+
The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-in interfaces are Uncommitted.
SEE ALSO
cat(1), ksh93(1), attributes(5), environ(5), largefile(5), standards(5)
SunOS 5.11 20 Nov 2007 tee(1)