how to direct standard output and error output to the same file in tcsh

how to direct standard output and error output to the same file in tcsh

Post by Snoop » Thu, 30 Nov 2000 04:00:00



Hello
    I am using tcsh.  How to direct standard and error output to the
same file?

Quote:> a.out > test.txt
> a.out >& test.txt

how to combine them together?

Thanks

STC

 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Mike Dowli » Fri, 01 Dec 2000 04:00:00



>Hello
>    I am using tcsh.  How to direct standard and error output to the
>same file?

>> a.out > test.txt
>> a.out >& test.txt

>how to combine them together?

$ a.out 2>&1 > test.txt

Cheers,
Mike

--

address.  It is a mail alias.  Once spammed, the alias is deleted, and
the integer 'N' incremented.  Currently, mike[37,38] are valid.  If
email to mikeN bounces, try mikeN+1.

 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Chris Matter » Fri, 01 Dec 2000 04:00:00




> >Hello
> >    I am using tcsh.  How to direct standard and error output to the
> >same file?

> >> a.out > test.txt
> >> a.out >& test.txt

The second *does* send both stdout and stderr to test.txt.
In tcsh, the trick is getting stdout and stderr to go to
*different* places
Quote:

> >how to combine them together?

> $ a.out 2>&1 > test.txt

Not in tcsh.
                      Chris Mattern
 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Glenn Wes » Fri, 01 Dec 2000 04:00:00






> > >Hello
> > >    I am using tcsh.  How to direct standard and error output to
the
> > >same file?

> > >> a.out > test.txt
> > >> a.out >& test.txt

> The second *does* send both stdout and stderr to test.txt.
> In tcsh, the trick is getting stdout and stderr to go to
> *different* places

> > >how to combine them together?

> > $ a.out 2>&1 > test.txt

> Not in tcsh.
>                       Chris Mattern

I wasn't sure how different tcsh was from csh so wasn't entirely sure
that Mike's solution was wrong.  It sure looked like a Bourne shellish
solution.  To direct stdout and stderr to different places in the csh
you have to do something like:

(a.out > stdout.log)>&stderr.log

I believe the essence of this is to run a.out in a subshell with stdout
redirected to a file.  stderr from that subshell is concatenated with
stdout from the subshell (of which there is none since we already
captured it into stdout.log!) and redirected into file stderr.log.

HTH...

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Snoop » Fri, 01 Dec 2000 04:00:00



> > >> a.out > test.txt
> > >> a.out >& test.txt

> The second *does* send both stdout and stderr to test.txt.
> In tcsh, the trick is getting stdout and stderr to go to
> *different* places

 Can you show me how to tell stdout and stderr to go to different places?

Thanks

STC

 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Mar » Fri, 01 Dec 2000 04:00:00




>> The second *does* send both stdout and stderr to test.txt.
>> In tcsh, the trick is getting stdout and stderr to go to
>> *different* places

> Can you show me how to tell stdout and stderr to go to different places?

Don't know about tcsh, but in standard sh or ksh:

echo blah > a                # stdout to file a, stderr not redirected
echo blah 2> a               # stderr to file a, stdout not redirected
echo blah > a 2>&1    # stderr and stdout to file a
echo blah > a 2> b        # stdout to file a, stderr to file b

--
Mark Styles - Oracle/Unix developer and DBA
http://www.lambic.co.uk

 
 
 

how to direct standard output and error output to the same file in tcsh

Post by Peter Sundstro » Sat, 02 Dec 2000 08:45:11



> Hello
>     I am using tcsh.  How to direct standard and error output to the
> same file?

> > a.out > test.txt
> > a.out >& test.txt

> how to combine them together?

Read http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ to see why this
simple operation is not as simple as it should be.
 
 
 

1. redirecting standard output and standard error

Hi,

I want to call a command using C programmatically using execv, but I
also want to capture the standard output and standard error to files I
specify through command line args.  I want to use the file descriptors
0, 1, and 2 appropriately for this, and I understand I should probably
call a fork()
when calling the execv so my program can return successfully.  But
from there,
I'm not sure where to start.  I think I want to probably use dup2 so I
can redirect the descriptors to files I open.  Maybe create a pipe
from the child process to the parent process, where I pass through the
pipe are the results of the command call ??  Just need some guidance
and want to make sure I'm in the right direction.  Thanks.

2. Please help...

3. differentiate between standard output and standard error?

4. VAX??? Can I?

5. How to redirect standard error to standard output (in csh)?

6. sun unix: WARNING: processor level 4 onboard interrupt not serviced

7. Redirecting standard output and error to a file

8. How do I copy a file from a Unix machine to a Win95/98 Machine?

9. How to redirect (and append) standard output/error to a log file?

10. How to redirect standard output and error messages in a make file

11. Perl script log file output has duplicate copies of output lines

12. Outputting to a log file and translating output

13. Solaris2.4/tcsh-6.05/NIS+: `tcsh' with funny terminal output