I have an executable that, depending on its input, outputs to either one file or several. It usually prints nothing on screen. The usual way to call this program is to specify an input and output filenames, like this:
It will then try to use the output filename exactly if it needs to output to one file, or it will start appending -01, -02, -03, -04 etc... to the name and create as many outputs as needed otherwise. (These are not a combination of output and error files, they are all output files only)
I want to force output everything from it on screen. If I change my code to:
then it will only work if the program wants to create one output file. But I get the error
in case it wants to output to several files. Is there another trick to forceall outputs from it to print on screen??
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)
Is there a way to redirect all stdout to a file implicitly - like defining stdout=/home/me/process.log - so that all "echo" commands in several scripts/subscripts are written to that file; instead of having to edit all scripts to redirect the "echo" (e.g. echo 'This is a test ' >>... (1 Reply)
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)
can anyone help me in making singleline command for
Capital Letters are folders ,small letter are files
X,Y,Z are subfolders of A
as shown below
A - X,Y,Z
Folder X has three files a.txt,b.txt,c.txt similarly Y,Z.
as shown below
X- a.txt,b.txt,c.txt
Y- a.txt,b.txt,c.txt
Z-... (4 Replies)
Hi all,
I've been looking around for this for a while and can't seem to find a satifactory way to do what I want:
I would like to assign the output of stdout to a variable and that of stderr to another one, and this without using temporary files/named pipes. In other words be able to assign... (4 Replies)
Hello,
I have a script (videostream.sh) which invokes the GStreamer command-line tool gst-launch with all the correct command line parameters. When I invoke this program, I add the '&' character at the end to make it a background task, so that my script can complete and exit, i.e.
gst-launch... (1 Reply)
I have a simple bash script that prints sth every 5 seconds. What I do is the following. I redirect the output of the script to a file, tail the file and see that it works and then from another console I delete the file where the output is redirected to. Even though I have deleted the file, the... (2 Replies)
I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Hello,
I'm strugling with some redirecting and all help is apreciated.
The following program is working as expected, but the result of the AT command doesn't go to any file.
Thanks in advance for the help.
#!/bin/bash
modem=/dev/ttyUSB1
file=/root/imsi.txt
# print error to stderr and exit... (4 Replies)
Well.. let's say i need to write a pretty simple script.
In my script i have 2 variables which can have value of 0 or 1.
$VERBOSE
$LOG
I need to implement these cases:
($VERBOSE = 0 && $LOG = 0) => ONLY ERROR output (STDERR to console && STDOUT to /dev/null)
($VERBOSE = 1... (5 Replies)
Discussion started by: Marmz
5 Replies
LEARN ABOUT DEBIAN
multitee
multitee(1) General Commands Manual multitee(1)NAME
multitee - send multiple inputs to multiple outputs
SYNTAX
multitee [ -bsize ] [ -vQq ] [ fd-fd,fd,fd... ] ...
DESCRIPTION
multitee sends multiple inputs to multiple outputs. Given an argument of the form fdin-fdout,fdout,fdout... it will send all input on
file descriptor fdin to each descriptor fdout. It will exit when all fdin are closed. Several arguments may specify outputs from the same
fdin.
-fdout and ,fdout are equivalent. If there is an error of any sort (including SIGPIPE) in writing to fdout, multitee prints a warning on
stderr and forgets fdout entirely. (This doesn't affect reads on fdin.) If -fdout is replaced by :fdout then multitee will exit upon any
SIGPIPEs from that descriptor.
Furthermore, efd means that as soon as fdin reaches end of file, fd is considered to reach EOF as well. multitee will warn about any input
errors and then treat them like EOF.
Unlike tee, multitee tries its best to continue processing all descriptors even while some of them are blocked. However, it will get stuck
reading if someone else is reading the descriptor and grabs the input first; it will get stuck writing if an input packet does not fit in
an output pipe. (If the output descriptor has NDELAY set, and multitee receives EWOULDBLOCK, it writes one byte at a time to avoid pipe
synchronization problems.) While it is tempting to set the descriptors to non-blocking mode, this is dangerous: other processes using the
same open file may not be able to deal with NDELAY. It is incredible that none of the major UNIX vendors or standards committees has come
up with true per-process non-blocking I/O. (Under BSD 4.3 and its variants, multitee could send timer signals to itself rapidly to inter-
rupt any blocking I/O. However, this cannot work under BSD 4.2, and is generally more trouble than it's worth.) A program can set NDELAY
before invoking multitee if it knows that no other processes will use the same open file.
multitee will also temporarily stop reading an input descriptor if more than 8192 bytes are pending on one of its output descriptors. This
does not affect independent fdin-fdout pairs.
multitee has several flags:
-bsize Change input buffer size from 8192 to size. Unlike the previous version of multitee, this version does not require output buf-
fers, and does not copy bytes anywhere between read() and write().
-v Verbose.
-q Quiet. multitee will not use stderr in any way (except, of course, if descriptor 2 is specified in an argument).
-Q Normal level of verbosity.
EXIT VALUE
0 normally. 1 for usage messages. 3 if multitee runs out of memory. 4 in various impossible situations.
DIAGNOSTICS
fatal: out of memory
multitee has run out of memory.
warning: cannot read descriptor
Self-explanatory.
warning: cannot write descriptor
Self-explanatory.
EXAMPLES
multitee 0-1,4,5 4>foo 5>bar
Same as tee foo bar except for better blocking behavior.
multitee 0:1 3:1 4:1,2 6:7
Merge several sources into the output, meanwhile copying 6 to 7 and recording 4's input in 2.
tcpclient servermachine smtp multitee 0:7 6:1e0
Same as mconnect on Suns. The e0 tells multitee to quit as soon as the network connection closes.
RESTRICTIONS
multitee expects all descriptors involved to be open. Currently a closed descriptor acts like an open descriptor which can never be writ-
ten to.
BUGS
None known.
VERSION
multitee version 3.0, 7/22/91.
AUTHOR
Placed into the public domain by Daniel J. Bernstein.
SEE ALSO tee(1)multitee(1)