Sponsored Content
Top Forums Shell Programming and Scripting Preserve output order when redirecting stdout and stderr Post 302383354 by radoulov on Tuesday 29th of December 2009 10:54:18 AM
Old 12-29-2009
Quote:
Originally Posted by methyl
This works for me where "2>&1" doesn't retain the order of the messages.
For example with unix "traceroute".

Code:
traceroute 10.10.10.10 2>>logfile.log 1>>logfile.log

The original poster wants two separate logs with stdout and stderr respectively and one with both of them in the correct order.

---------- Post updated at 04:54 PM ---------- Previous update was at 04:40 PM ----------

Quote:
nice solution with the subshells , but unfortunately this does also not work at all.
This works well if you have outputs to stdout and stderr alternating, but if there is more then one lines written to one of stdout or stderr, the numbering increases for this one, but not for the other one ...

Just tried it out ...
You're right.
It just doesn't work.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sending syslog output to stderr or stdout

Is there a way to send the syslog output for a given facility to stderr or stdout? I do not want to use the "tail" command to achieve this, I would like it to go directly to stderr. Thanks in advance (1 Reply)
Discussion started by: dmirza
1 Replies

2. Shell Programming and Scripting

redirecting STDOUT & STDERR

In bash, I need to send the STDOUT and STDERR from a command to one file, and then just STDERR to another file. Doing one or the other using redirects is easy, but trying to do both at once is a bit tricky. Anyone have any ideas? (9 Replies)
Discussion started by: jshinaman
9 Replies

3. Shell Programming and Scripting

getting stderr & stdout output lively modified

This is about getting all output to stderr and stdout localized. Nothing to do with redirecting output to a file (there already are some interesting threads about that issue on this forum). What I intend to do is capturing all lines of text sent to the screen, compare them with an array of... (2 Replies)
Discussion started by: teo ramirez
2 Replies

4. Shell Programming and Scripting

Redirecting STDERR message to STDOUT & file at same time

Friends I have to redirect STDERR messages both to screen and also capture the same in a file. 2 > &1 | tee file works but it also displays the non error messages to file, while i only need error messages. Can anyone help?? (10 Replies)
Discussion started by: vikashtulsiyan
10 Replies

5. Shell Programming and Scripting

Redirecting part of output to stdout

Hi, I am trying to execute a command like this: find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the... (2 Replies)
Discussion started by: Legend986
2 Replies

6. Shell Programming and Scripting

redirect stdout and stderr to file wrong order problem with subshell

Hello I read a lot of post related to this topic, but nothing helped me. :mad: I'm running a ksh script with subshell what processing some ldap command. I need to check output for possible errors. #!/bin/ksh ... readinput < $QCHAT_INPUT |& while read -p line do echo $line ... (3 Replies)
Discussion started by: Osim
3 Replies

7. Shell Programming and Scripting

File descriptors, redirecting output, and stdout

Hello all. I've been lurking here for a year or two and finally decided to post. I need some assistance with file descriptors, stdout, and redirecting output. I've searched through a number of very helpful threads here (unfortunately I can't link to any of them yet due to my low post count...),... (2 Replies)
Discussion started by: Michael_K
2 Replies

8. Shell Programming and Scripting

Redirecting STDERR to file and screen, STDOUT only to file

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

9. Shell Programming and Scripting

Lost redirecting stderr & stdout to 3 files - one each plus combined

Hi folks I need/want to redirect output (stdout, stderr) from an exec call to separate files. One for stderr only and two(!) different (!) ones for the combined output of stderr and stdout. After some research and testing i got this so far : (( exec ${command} ${command_parameters} 3>&1... (6 Replies)
Discussion started by: MDominok
6 Replies

10. Shell Programming and Scripting

Redirecting stdout output to whiptail menu box

As a result of whiptail menu option I am getting a data from a file. Naturally it is output to terminal as stdour. I like to redirect the output back to the menu. It can be done with single input of line of text , see attached. I just cannot see where or how the sample... (0 Replies)
Discussion started by: annacreek
0 Replies
OMPI-IOF(1)							     Open MPI							       OMPI-IOF(1)

NAME
ompi-iof, orte-iof - Displays a copy of the output streams from a process. NOTE: ompi-iof, and orte-iof are exact synonyms for each other. Using any of the names will result in exactly identical behavior. SYNOPSIS
ompi-iof [ options ] Options ompi-iof will display a copy of the indicated stdout, stderr, and/or stddiag streams from the designated process. -pid | --pid The pid of the mpirun executing the process whose streams are to be copied -stdout | --stdout Display a copy of the specified process' stdout. If no options are specified, this will act as the default -stderr | --stderr Display a copy of the specified process' stderr. -stddiag | --stddiag Display a copy of the specified process' stddiag. -rank | --rank The rank of the process whose output is to be copied. DESCRIPTION
ompi-iof displays a copy of the indicated stdout, stderr, and/or stddiag streams from the designated process. At this time, a ctrl-C must be used to terminate the program. The program will terminate cleanly, telling the associated mpirun to close the requested streams before exiting. SEE ALSO
orterun(1) 1.4.5 Feb 10, 2012 OMPI-IOF(1)
All times are GMT -4. The time now is 12:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy