writting a command in a .txt!

Ramon00

New Member
Joined
Jul 29, 2021
Messages
22
Reaction score
0
Credits
202
Hi folks, i'm trying to save an output from a linux command like this "dvbv5-zap -c channels.conf 472000000 -m --timeout=10 >> channels" but when i open the file channels nothing has been written on it. Can you help me?
 


Is it actually outputting something? If so, maybe it's sending to STDERR instead of STDOUT which is what it looks like you're tryingto collect.

To write all standard output file descriptors to the same place, use "2>&1" instead of ">>"

So if you're trying to write to a file called channels.
Code:
dvbv5-zap -c channels.conf 472000000 -m --timeout=10 2>&1 channels
 
Is it actually outputting something? If so, maybe it's sending to STDERR instead of STDOUT which is what it looks like you're tryingto collect.

To write all standard output file descriptors to the same place, use "2>&1" instead of ">>"

So if you're trying to write to a file called channels.
Code:
dvbv5-zap -c channels.conf 472000000 -m --timeout=10 2>&1 channels
So when i do instead "dvbv5-scan initial_dvbv5.scan -F > output.scan" and what appears in command line is:

(0x00) Quality= Poor UCB= 1836 postBER= 582x10^-6 preBER= 477x10^-6 PER= Lock (0x1f) Signal= -75.00dBm C/N= 21.39dB preBER= 1.00

But what saves in the output file is:


Scanning frequency #1 474000000
Service RTP1, provider (null): reserved
Service RTP2, provider (null): reserved
Service SIC, provider (null): reserved
Service SIC Not\u00edcias, provider (null): reserved
Service TVI, provider (null): reserved

But what i want to save is this part:

(0x00) Quality= Poor UCB= 1836 postBER= 582x10^-6 preBER= 477x10^-6 PER= Lock (0x1f) Signal= -75.00dBm C/N= 21.39dB preBER= 1.00

Can you help me?
 
I don't know anything about this application you're running, but on a command line there are usually two different types of output standard output (STDOUT) and error output STDERR. They are defined by their fd socket. (fd = File Descriptor)

So, by default you pipe the output of a command to a file, it's outputting #1 or STDOUT.
Code:
./mycommand > output.txt

Sometimes you will see output that doesn't make it into the file. This is usually STDERR or error messages. They are usually output on fd #2 or STDERR.

Many people redirect both STDOUT and STDERR to the same place so the file has both the STDERR and STDOUT contents. This is what I provided in the post above.
Code:
./mycommand 2>&1 output.txt

Specifically, 2>&1 says output fd 2 (STDERR) output & (meaning @) fd 1 (STDOUT) then write them both to disk.

Finally, if you want STDOUT to go to one place and STDERR to a second, you can specify it as such.
Code:
./mycommand >stdout.ext 2>stderr.txt
 

Members online


Top