Sponsored Content
Top Forums Shell Programming and Scripting How redirect output(error and normal) to 2 different files Post 302135784 by robotronic on Wednesday 12th of September 2007 01:05:31 PM
Old 09-12-2007
I didn't understand very well... If you want two files, one for the output and one for the errors, try:

Code:
./your_command 2>err_file.txt 1>out_file.txt

Otherwise, if you want to redirect both stderr and stdout to a single logfile, try:

Code:
./your_command >log_file.txt 2>&1

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Redirect output to multiple files.

Hi, I am new to shell scripting and have a question. I would like to redirect the output of a command to multiple files, each file holding the exact same copy. From what I read from the bash manpage and from some searching it seems it cannot be done within the shell except setting up a loop. Is... (3 Replies)
Discussion started by: cbkihong
3 Replies

2. Shell Programming and Scripting

Ping: redirect output and error

Hi, I use this function (now modified with elif) for check if a pc is up: check_pc() { $PING $PC 1 2> /dev/null if ; then check_dir #Other function echo "Begin backup operation for $PC" echo "$SMBTAR -s $PC -u $USER -p $PASS -x $SHARE$EXCL -t - | gzip -c >... (3 Replies)
Discussion started by: mbarberis
3 Replies

3. Shell Programming and Scripting

Dynamically redirect output to duplicate files ???

Hi There are many posts in this forum regarding reditecting output, but mine is a different problem, please have a look. My shell script is redirecting output to a log file dynamically. That is it is using - exec > log1.txt 2>&1 Hence all the traces are appearing in the log1.txt. I want... (3 Replies)
Discussion started by: nsinha
3 Replies

4. Shell Programming and Scripting

redirect only the standard error output to mail

I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
Discussion started by: barkath
3 Replies

5. Shell Programming and Scripting

Ambiguous output redirect error

Hi everyone, While I was trying to do DATE=`date +"%Y%m%d_%H%M%S"` STARTLOG=$TUXSTDDIR/start_$DATE.log tmboot -y > $STARTLOG 2>&1 I got an error i.e. Ambiguous output redirect error. Here the first part is to boot the account so there is nothing wrong with that.... (6 Replies)
Discussion started by: pareshan
6 Replies

6. Shell Programming and Scripting

How to redirect the output to multiple files without putting on console

How to redirect the output to multiple files without putting on console I tried tee but it writes to STDOUT , which I do not want. Test.sh ------------------ #!/bin/ksh echo "Hello " tee -a file1 file2 ---------------------------- $>./Test.sh $> Expected output: -------------------... (2 Replies)
Discussion started by: prashant43
2 Replies

7. Shell Programming and Scripting

Redirect Output and Error in 2 different files

hi, i want to redirect my output & error if generated to two different files. I have written the code for redirecting the output, i dnt have ne idea how to go abt it for errors. I tried spooling which was given in one of the threads on this forum.But it didn't work.The script i wrote as a lot... (4 Replies)
Discussion started by: bankimmehta
4 Replies

8. Shell Programming and Scripting

Print duplicate only lines as normal output - Awk

input output a1 100 200 XYZ_X a1 98 188 ABC (2 Replies)
Discussion started by: quincyjones
2 Replies

9. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies

10. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies
ICECREAM(1)							     icecream							       ICECREAM(1)

NAME
icecream - download icecast and shoutcast streams, redirecting all fetched content to stdout and/or to disk at the same time SYNOPSIS
icecream [OPTIONS] URL [URL..] DESCRIPTION
icecream is a lightweight, non-interactive, stream download utility. It connects to icecast and shoutcast servers or direct stream URLs, and redirects all fetched content to stdout and/or to media files on your disk. Listen to the stream piping the output to a stdin-capable media player. Save the stream to a named file or split it into different tracks. It is possible to redirect the stream and save it to disk at the same time. icecream is able to parse pls and m3u playlists, and to download mp3 and ogg direct stream URLs. If the stream is anonymous it will be saved as 'stream-time.mp3', where time is actual timestamp. OPTIONS
-h, --help Print a help message describing all options -q, --quiet Turn off output -v, --verbose Be verbose -t, --tracks Split stream into tracks (if possible) --name=NAME Save the stream to file specified by NAME. Format codes starting with "%" will be replaced. See the date command for valid format codes. --stop=N[units] Stop downloading the stream after N kb/mb/min/songs --user-agent=AGENT Set user-agent header to AGENT --stdout Output stream to stdout (implies -q) --sync Turn syncing on, required for some mpeg players that read from stdin --debug Turn on debugging outputs EXAMPLES
Streaming to mpg123 icecream --stdout http://radio.com/playlist.pls | mpg123 - Split stream into different tracks icecream -t http://metal.org/radio.pls Split stream into tracks and play with vlc at the same time icecream -t --stdout http://streaming.com/playlist.pls | vlc file:/dev/stdin Prepare a 74 minute CD icecream -t --stop 74min http://trace.net/playlist.m3u Use a filename with today's date as output icecream -q --name 'radio_%Y_%m_%d' --stop 60min http://radio.com/playlist.pls BUGS
You are welcome to send bug reports about icecream to our mailing list. Feel free to visit http://icecream.sourceforge.net AUTHOR
Written by Gil Megidish <gil at megidish.net> 1.3 2008-04-28 ICECREAM(1)
All times are GMT -4. The time now is 06:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy