Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all, I'm trying to redirect output of a script to a file. But output in file differs from what has been shown on screen.
Is there any way to redirect exact screen output to a file?
As the hardest part of my problem, I'm using wget to download 999,999,999 files and I want to have the output in a file(then I'm processing these data), but each percentage of download which is completed is shown in file for several time, I want the exact output of screen to a file.
Then you are not seeing either stdout or stderr you either need to be more specific or what you are seeing cannot be redirected(which should be impossible but some ncurses and other things could be a factor).
So your only issue is the pretty bar that it draws out showing your download progress? You will have to deal with that. Your redirection is working as intended.
If you are also concerned that your download times are slightly different, that is the way the internet works. Your speed is never going to be 100% the same, however it should stay within a relative range.
There is a difference between being connected to a terminal and sending output to a file, as the man page of wget states:
Quote:
The "bar" indicator is used by default. It draws an ASCII progress bar graphics (a.k.a
"thermometer" display) indicating the status of retrieval. If the output is not a TTY, the "dot"
will be used by default.
but you can force wget to display the "bar" indicator by means of:
Hi all, I'm trying to redirect output of a script to a file. But output in file differs from what has been shown on screen.
Is there any way to redirect exact screen output to a file?
As the hardest part of my problem, I'm using wget to download 999,999,999 files and I want to have the output in a file(then I'm processing these data), but each percentage of download which is completed is shown in file for several time, I want the exact output of screen to a file.
Try the "script" utility. It will record everything sent to the screen, including any escape sequences for handling color, screen positions...
It even records the <cr><lf> of the physical I/O for the end of lines.
based on my understanding of your problem statement : content of log file differs from console output.
Try tee
<command> | tee /tmp/log -- to create /tmp/log or null existing file /tmp/log and write to it.
<command> | tee -a /tmp.log -- to append output to file /tmp/log
Last edited by smbhandary; 02-19-2013 at 11:05 PM.
Tee works sometimes - It depends on whether the program tests for a real terminal or not and generates different output.
Tee is designed for use in a pipe (as shown), but not with some other applications (such as an editor).
Even "ls" works differently - if the output is attached to a terminal then it will use a multi-column output with color highlighting. If it is attached to a pipe, then it outputs a single column, with no escape sequences for color highlighting.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.