LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   redirect results to file (https://www.linuxquestions.org/questions/linux-newbie-8/redirect-results-to-file-4175481125/)

relwe 10-17-2013 01:13 AM

redirect results to file
 
I want to redirect this:
Unloading HCA driver: [ OK ]
Loading HCA driver and Access Layer: [ OK ]
Setting up InfiniBand network interfaces:
Error adding address 11.7.5.129 for ib0.
Bringing up interface ib0: [ OK ]
Bringing up interface ib1: [ OK ]
No configuration found for ib2
Bringing up interface ib3: [ OK ]
Setting up service network . . . [ done ]

to a file but when I'm doing this the [ OK ] and [ done ] look weird in the file. Is there an option to do it normally?
Thx.

pan64 10-17-2013 01:16 AM

the most simple way probably to filter it with cat:
<commands or script> | cat > write_to_file

relwe 10-17-2013 03:23 AM

Thanks but it didn't help.

SAbhi 10-17-2013 03:40 AM

Quote:

Originally Posted by relwe (Post 5047291)
I want to redirect this:
Unloading HCA driver: [ OK ]
Loading HCA driver and Access Layer: [ OK ]
Setting up InfiniBand network interfaces:
Error adding address 11.7.5.129 for ib0.
Bringing up interface ib0: [ OK ]
Bringing up interface ib1: [ OK ]
No configuration found for ib2
Bringing up interface ib3: [ OK ]
Setting up service network . . . [ done ]

to a file but when I'm doing this the [ OK ] and [ done ] look weird in the file. Is there an option to do it normally?
Thx.

It looks like linux boot time messages when the kernel loads and it start services. If yes, Why did you need this to be redirected to separate file while linux already has a log location setup for bootup messages ?

Code:

dmesg
/var/log/boot.*

are some of the examples to look into.

**NOTE: unless something is a kernel driver or parameter it wouldnt show in "dmesg".

relwe 10-17-2013 06:09 AM

It is not linux boot time log, it is something else.

TobiSGD 10-17-2013 07:14 AM

Often messages like these have colored output for things like [OK] or [done]. The terminal wouldn't display the color-codes, but change the colors. This is of course not possible in a text file, so the color-codes are also logged. The solution would be to adapt your scripts, so that they don't use colored output.


All times are GMT -5. The time now is 10:02 PM.