Sponsored Content
Full Discussion: How to "tee" stderr
Top Forums Shell Programming and Scripting How to "tee" stderr Post 302515754 by stevensw on Wednesday 20th of April 2011 07:43:19 PM
Old 04-20-2011
How to "tee" stderr

In other words, print on both the screen and to a file (minus stdout)? Thanks again in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding custom mesg. when redirecting "exec 2>stderr.err" ?

Doubt regarding using "exec" command to redirect the STDERR to a file. e.g I did it this way. mystage.sh #!/bin/sh exec 2>stage.err .... .... cat stage.err mv: cannot move `/root/stage' to a subdirectory of itself, `/root/stage_old/stage' ls: *.zDB: No such file or... (0 Replies)
Discussion started by: snurani
0 Replies

2. Shell Programming and Scripting

Why stderr file descriptor redirection makes ksh's "select" construct hang.

I am trying to use one global declaration --> "exec 2>$ERR" to capture all stderr outputs that may occur anywhere in my script. Then close it at the end of the script using --> "exec 2<&-" I am using KSH on Solaris 8. KSH Version M-11/16/88i If I comment two "exec .." statements in the... (11 Replies)
Discussion started by: kchinnam
11 Replies

3. Shell Programming and Scripting

tar "--totals" writes to stderr not stdout?

I want to use the "--totals" option in GNU tar for some reporting, however I have discovered that it writes the output to stderr not stdout and I would like to know why. This is running from BASH. mkdir /tmp/test touch /tmp/test/foo.file cd /tmp/ tar --totals -clpzf test.tar.gz test 2>... (2 Replies)
Discussion started by: jelloir
2 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. UNIX for Dummies Questions & Answers

Confused over results using "tee" in piped command

First post here, so hopefully all guidelines are followed, and thanks in advance for any replies. I'm working on a shell script(BASH) that processes a csv file and performs various tasks with the data. All is well, except I want to use 'tee' to send output from 'wc' to a file as well as pipe it... (4 Replies)
Discussion started by: jazzmusic
4 Replies

6. Shell Programming and Scripting

Screen output is blocked by "| tee" command

BACK STORY: I have a script build.py . (It's for creating the ISO file for a special edition of Swift Linux.) This build.py script executes the mintConstructor.py script that I use to modify the Regular Swift Linux ISO to get the special edition Swift Linux ISO. The lines of the script that... (2 Replies)
Discussion started by: swiftlinux
2 Replies

7. Homework & Coursework Questions

C++ with Linux - writing a "tee"-like function

Greetings, everyone. 1. The problem statement, all variables and given/known data: I'm running into a problem with my program concerning the actual output it does. When I open the file that gets the output, it contains a large number of hex(?) variables and not what the user wants. The... (0 Replies)
Discussion started by: assignmentoper
0 Replies

8. Shell Programming and Scripting

The pipe not use "tee" to print on the screen for specific function

I have code fragment like { aa bb cc } > $LOG aa bb cc, all call function "ff", I want "ff" to print on the screen,but others do not print on the scree, is there a method? I can't use "tee", becasue tee I meet the write "error" ff() { echo "hello" } (2 Replies)
Discussion started by: yanglei_fage
2 Replies

9. UNIX for Beginners Questions & Answers

Append content using "tee" command

Hi, How to append content into a file using tee command echo " file1 is archived"| tee -a archive.txt echo " file2 is archived"| tee -a archive.txt echo " file3 is archived"| tee -a archive.txt how to append content as new rows in the archive.txt Thanks, Srinadh. (4 Replies)
Discussion started by: srinadhreddy27
4 Replies

10. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies
tee(1)							      General Commands Manual							    tee(1)

NAME
tee - Displays the output of a program and copies it into a file SYNOPSIS
tee [-ai] file... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: tee: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Adds the output to the end of file instead of writing over it. Ignores the SIGINT signal. OPERANDS
Standard input is stored into, or appended to, the file specified. [Tru64 UNIX] The tee command can accept up to 20 file arguments. DESCRIPTION
The tee command reads standard input and writes to both standard output, and each specified file. The tee command is useful when you wish to view program output as it is displayed, and also want to save it in a file. The tee command does not buffer output, so you may wish to pipe the output of tee to more if more than one full screen of data is anticipated. NOTES
If a write to any file fails, the exit status of tee will be non-zero. Writes to all other specified files may be successful, and opera- tion will continue until standard input is exhausted. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To view and save the output from a command at the same time, enter: lint program.c | tee program.lint This displays the standard output of the command lint program.c at the terminal, and at the same time saves a copy of it in the file program.lint. If program.lint already exists, it is deleted and replaced. To display and append to a file, enter: lint program.c | tee -a program.lint This displays the standard output of lint program.c at the terminal and at the same time appends a copy of it to the end of pro- gram.lint. If the file program.lint does not exist, it is created. ENVIRONMENT VARIABLES
The following environment variables affect the execution of tee: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cat(1), echo(1), script(1) Standards: standards(5) tee(1)
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy