[R] R as Unix-Filter and Streams for DataMining

Douglas Bates bates at stat.wisc.edu
Fri Dec 3 17:39:53 CET 1999


Douglas Bates <bates at cs.wisc.edu> writes:

> "John D. Barnett" <jbarnett at wi.mit.edu> writes:
> 
> > Two (klugey) ideas--
> > 
> > - write a script which reads standard input, and reads a file, and outputs
> > both of them to standard output.  (Maybe there's a command that does this
> > already; anyone know?)  
> 
> Most Unix/Linux systems have a command called "tee", which makes
> "T-joints" in pipes.
> 
> $ tee --help
> Usage: tee [OPTION]... [FILE]...
> Copy standard input to each FILE, and also to standard output.
> 
>   -a, --append              append to the given FILEs, do not overwrite
>   -i, --ignore-interrupts   ignore interrupt signals
>       --help                display this help and exit
>       --version             output version information and exit

I realize now that I answered the wrong question - you want to know
how to _read_ standard input and a file, not how to write it.  The
answer is to use "cat" in the form
 cmd1 | cat - [FILE] | cmd2

 $ cat --help
 Usage: cat [OPTION] [FILE]...
 Concatenate FILE(s), or standard input, to standard output.

   -A, --show-all           equivalent to -vET
   -b, --number-nonblank    number nonblank output lines
   -e                       equivalent to -vE
   -E, --show-ends          display $ at end of each line
   -n, --number             number all output lines
   -s, --squeeze-blank      never more than one single blank line
   -t                       equivalent to -vT
   -T, --show-tabs          display TAB characters as ^I
   -u                       (ignored)
   -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
       --help               display this help and exit
       --version            output version information and exit

 With no FILE, or when FILE is -, read standard input.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list