I'm trying to capture dvdauthor's output to a file.
So far i found this command but it's not working:S
dvdauthor -x dvdauthor.xml > output.txt
Any kind of idea is really appreciated.
It looks as though dvdauthor prints a lot of output to stderr rather than stdout. I don't have this software myself and so can't be sure but I see a lot of this in (what I presume to be) the source code, which suggests that it's printing informational messages to stderr rather than stdout:
fprintf(stderr, "INFO: dvdauthor creating table of contents\n");
The > redirect will only redirect stdout to file. To redirect stderr to file, you can use '2>'
Try:
dvdauthor -x dvdauthor.xml 2> output.txt
You might find the BASH programming introduction useful for more info on redirecting output: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html
Related
I have a script using for a building a program that I redirect to sed to highlight errors and such during the build.
This works great, but the problem is at the end of this build script it starts an application which usually writes to the terminal, but stdout and stderr redirection doesn't seem to capture it. I'm not exactly sure how this output gets printed and it's kind of complicated to figure out.
buildAndStartApp # everything outputs correctly
buildAndStartApp 2>&1 | colorize # Catches build output, but not server output
Is there any way to capture all terminal output? The "script" command catches everything, but I would like the output to still print to my terminal rather than redirecting to a file.
I found out script has a -c option which runs a command and all of the output is printed to stdout as well as to a file.
My command ended up being:
script -c "buildAndStartApp" /dev/null | colorize
First, when you use script, the output does still go to the terminal (as well as redirecting to the file). You could do something like this in a second window to see the colorized output live:
tail -f typescript | colorize
Second, if the output of a command is going to the terminal even though you have both stdout and stderr redirected, it's possible that the command is writing directly to /dev/tty, in which case something like script that uses a pseudo-terminal is the only thing that will work.
if you do
ipconfig.exe 1> output.log 2>&1
this will direct all output(both stdout and stderr) to "output.log".
However, if you do (changing the order in which you specify desired redirections)
ipconfig.exe 2>&1 1> output.log
this will not achieve the intended effect of printing both output streams to "output.log" because "stderr" in this case will be printed to the console.
I suspect this has to do with the way "cmd" parses commands that gives different meanings depending on the order in which you specify redirects.
If so, what are the semantic rules and where are they documented?
I reckon this is something worth finding out as it could waste people hours by making them scratching their head trying to figure out why their redirection is not working.
The redirections are simply parsed left to right. Initially stdout and stderr are pointing to the console, so when you redirect stderr to where stdout is currently pointing in the second example, you are directing stderr to the console. You then subsequently redirect stdout to a file.
The explanations and examples here are quite good for further reference.
I want to capture the errors from a script into a file instead of to the screen.
In *nix, this is done with stderr redirection, usually
echo "Error" 2> errorfile.log
How do I do it in a CMD script under Windows?
For example:
PSKILL NOTEPAD >output.txt 2>&1
This will direct stdout and stderr to a file name output.txt.
See Underused features of Windows batch files for more details.
That should work in Win32, too.
If you have already redirected stdout, and want stderr redirected to the same file, you must use the 2>& special form, rather than just specifying the same file twice. Otherwise you'll get a "file busy" error.
I'm trying to redirect the java compiler output to a file.
I thought it's supposed to be:
javac file.java > log.txt
or something. Instead, I see all the output on the terminal and nothing in log.txt!
Also, if I want to log errors too, do I do
javac file.java 2>&1 > log.txt
?
javac file.java 2> log.txt
The reason is that you have two output file descriptors instead of one. The usual one is stdout, which you can redirect with > and it's supposed to be used for resulting output. The second one, stderr, is meant for human readable output like warnings, errors, current status etc., this one is redirected with 2>.
Your second line, using 2>&1, redirects stderr to stdout and finally stdout into log.txt.
Have you tried
javac -Xstdout log.txt file.java
This will send compiler errors to a log file instead of stderr.
I'm trying to redirect the results of darknet(yolo) program to my log file.
But there are some troubles in redirecting the result.
I tried ./darknet detect cfg/yolo.cfg yolo.weights image.jpg > log.txt, but it doesn't work.
And also other redirecting methods are not working.
I think the results of darknet program is not printed to stdout but printed to somewhere.( I don't know where it is.)
So, I have no idea to solve this problem.
Please help me...
How do I get this results in forms of file?
This appends all the standard output into a file. Remove 2>&1 if you don't want to log standard errors.
./darknet detect cfg/yolo.cfg yolo.weights image.jpg 2>&1 | tee -a log.txt
Detail info here.