Topic: Tee (T pipe connector)  (Read 3239 times)

0 Members and 1 Guest are viewing this topic.

Tee (T pipe connector)
« on: October 20, 2010, 02:14:08 PM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 1954
Tee is a simple T pipe connector.

I had the need for piping console output to a file while at the same time displaying the output in the console itself. I came across this tee program by Joao Magalhaes here and modified the sourcecode for x86/x64 etc.

Updated package here:   * tee.rar (42.1 kB - downloaded 295 times.)

Further information about tee (from the help file):

TEE is a Unix-like T pipe connection for DOS and works like all other text filters.

A pipe is a series of command or device redirections, by means of |,>, >> or <. For instance:
Code: [Select]
type file.txt | sort /r > prn
sort < file.txt | find /i "Something" >> myfinds.txt
are pipes.

Tee, like a T connector, diverts a copy of the contents of the "main pipe", at the point where it was placed, to a file.

If no T file is specified, it writes or appends to a file named tee.out. It recognizes the '-a' (append) option, and by default overwrites the T file. Option '-i' is not supported.

Generic syntax:

[pipe] | TEE [-a] [teefile] [ | pipe]
TEE [-a] [teefile] < inputfile [ | pipe]

Examples:
Code: [Select]
type < infile.txt |tee
tee < infile.txt
Writes the contents of file infile.txt both to default file tee.out, overwriting it, and to the standard output (monitor).

Code: [Select]
type < infile.txt | tee -a
tee -a < infile.txt
Appends the contents of file infile.txt to default file tee.out and displays infile.txt to the standard output (monitor).

Code: [Select]
type < infile.txt | tee testfile.txt > lpt1Writes the contents of file infile.txt to file testfile.txt and writes infile.txt to the LPT1 serial port (printer 1.)

Code: [Select]
type < infile.txt | tee -a file1.txt | sort > outfile.txtAppends the contents of file infile.txt to file file1.txt, the file is sorted and the result written to outfile.txt.

Code: [Select]
tee file1.txt < infile.txt | sort | tee -a file2.txt | sort /r > prnWrites infile.txt to file1.txt, sorts infile.txt, appends the result to file2.txt, sorts the result in reverse order and writes it to the printer (LPT1).

TEE is user-supported freeware with ANSI C source and a MS-DOS executable (and now also compiled for x86 and x64).

Regards,
Galapo



Re: Tee (T pipe connector)
« Reply #1 on: October 21, 2010, 10:23:06 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7012
 :thumbsup: I feel it can be used as a nice debugger for batches.
First one that came to my mind (and my need) genvirginmaker...
I need time to play this nice utility.

Thanks Galapo letting us know  :great:

Re: Tee (T pipe connector)
« Reply #2 on: October 21, 2010, 11:22:07 PM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 1954
I feel it can be used as a nice debugger for batches.
Yes, that's right -- now no longer if something needs to be piped does it need to be hidden from the console. With tee.exe, now you can both pipe something as well as have what is piped display in the console as if the pipe wasn't occurring.

Regards,
Galapo.

 

Powered by EzPortal