Sponsored Content
Top Forums Shell Programming and Scripting Dynamically redirect output to duplicate files ??? Post 302137416 by nsinha on Tuesday 25th of September 2007 01:41:42 AM
Old 09-25-2007
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 to redirect the same output to another file log2.txt which will contain the same thing that log1.txt is holding. I have tried in many different ways but nothing is working. "tee" isn't working here like -
exec > log1.txt 2>&1 | tee -a log2.txt

Can you please help me regarding this, I am totally clueless.

Thanks
Nirmalya Sinha
 

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. UNIX for Dummies Questions & Answers

How to redirect duplicate lines from a file????

Hi, I am having a file which contains many duplicate lines. I wanted to redirect these duplicate lines into another file. Suppose I have a file called file_dup.txt which contains some line as file_dup.txt A100-R1 ACCOUNTING-CONTROL ACTONA-ACTASTOR ADMIN-AUTH-STATS ACTONA-ACTASTOR... (3 Replies)
Discussion started by: zing_foru
3 Replies

3. Shell Programming and Scripting

How redirect output(error and normal) to 2 different files

Hello, I have a java program which i am calling in shell script. I wanted to redirect output to 2 differetn files. Output should have both 1 & 2 (normal and error) in both file. pls help (2 Replies)
Discussion started by: balareddy
2 Replies

4. Shell Programming and Scripting

Find duplicate value comparing 2 files and create an output

I need a perl script which will create an output file after comparing two diff file in a directory path: /export/home/abc/file1 /export/home/abc/file2 File Format: <IP>TAB<DeviceName><TAB>DESCRIPTIONS file1: 10.1.2.1.3<tab>abc123def<tab>xyz.mm1.ppp.... (2 Replies)
Discussion started by: ricky007
2 Replies

5. 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

6. 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

7. 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

8. Shell Programming and Scripting

Duplicate files and output list

Gents, I have a file like this. 1 1 1 2 2 3 2 4 2 5 3 6 3 7 4 8 5 9 I would like to get something like it 1 1 2 2 3 4 5 3 6 7 Thanks in advance for your support :b: (8 Replies)
Discussion started by: jiam912
8 Replies

9. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

10. Shell Programming and Scripting

Print loop output on same line dynamically

Hi, I am trying to print copy percentage completion dynamically by using the script below, #!/bin/bash dest_size=0 orig_size=`du -sk $sourcefile | awk '{print $1}'` while ; do dest_size=`du -sk $destfile | awk '{print $1}'` coyp_percentage=`echo "scale=2; $dest_size*100/$orig_size"... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
DIFF3(1)							     GNU Tools								  DIFF3(1)

NAME
diff3 - find differences between three files SYNOPSIS
diff3 [options] mine older yours DESCRIPTION
The diff3 command compares three files and outputs descriptions of their differences. The files to compare are mine, older, and yours. At most one of these three file names may be -, which tells diff3 to read the standard input for that file. Options Below is a summary of all of the options that GNU diff3 accepts. Multiple single letter options (unless they take an argument) can be com- bined into a single command line argument. -a Treat all files as text and compare them line-by-line, even if they do not appear to be text. -A Incorporate all changes from older to yours into mine, surrounding all conflicts with bracket lines. -B Old behavior of -A. Shows non-conflicts. -e Generate an ed script that incorporates all the changes from older to yours into mine. -E Like -e, except bracket lines from overlapping changes' first and third files. With -e, an overlapping change looks like this: <<<<<<< mine lines from mine ======= lines from yours >>>>>>> yours --ed Generate an ed script that incorporates all the changes from older to yours into mine. --easy-only Like -e, except output only the nonoverlapping changes. -i Generate w and q commands at the end of the ed script for System V compatibility. This option must be combined with one of the -AeExX3 options, and may not be combined with -m. --initial-tab Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal. -L label --label=label Use the label label for the brackets output by the -A, -E and -X options. This option may be given up to three times, one for each input file. The default labels are the names of the input files. Thus diff3 -L X -L Y -L Z -m A B C acts like diff3 -m A B C , except that the output looks like it came from files named X, Y and Z rather than from files named A, B and C. -m --merge Apply the edit script to the first file and send the result to standard output. Unlike piping the output from diff3 to ed, this works even for binary files and incomplete lines. -A is assumed if no edit script option is specified. --overlap-only Like -e, except output only the overlapping changes. --show-all Incorporate all unmerged changes from older to yours into mine, surrounding all overlapping changes with bracket lines. --show-overlap Like -e, except bracket lines from overlapping changes' first and third files. -T Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal. --text Treat all files as text and compare them line-by-line, even if they do not appear to be text. -v --version Output the version number of diff3. -x Like -e, except output only the overlapping changes. -X Like -E, except output only the overlapping changes. In other words, like -x, except bracket changes as in -E. -3 Like -e, except output only the nonoverlapping changes. SEE ALSO
cmp(1), comm(1), diff(1), ed(1), patch(1), sdiff(1). DIAGNOSTICS
An exit status of 0 means diff3 was successful, 1 means some conflicts were found, and 2 means trouble. GNU Tools 22sep1993 DIFF3(1)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy