GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
TUC(1) FreeBSD General Commands Manual TUC(1)

tuc
Text to Unix Conversion (v1.10)

tuc [-d|D] [-i inputfile] [-o outputfile]

tuc [-d|D] [inputfile [outputfile]]

The tuc utility converts text files from DOS, or any operating system to UNIX style text files. As of version 1.10, it optionally converts files to DOS style text files.

Tuc does more than simply strip (or insert) carriage returns. It uses a state machine to check for the following line endings:

cr/lf
cr/lf/lf... (for multiple lines)
cr
lf/cr
lf

Because of that, tuc can convert files created under any operating system to UNIX text files.

The tuc utility exits 0 on success, 1 when the command line is invalid, or 2 when it cannot open a file.

To convert a file to UNIX text file simply enter:

tuc inputfile outputfile

Inputfile is a text file created in any operating system. It can use any combination of carriage returns and line feeds as line terminators.

If no outputfile is specified, the output is sent to stdout. Similarly, if no inputfile is listed, tuc reads its input from stdin.

If you wish to read input from stdin but send output to a file, use the -o flag followed by outputfile. For example,

tuc -o outputfile

You may also use the -i flag to specify inputfile explicitly. If you use both -i and -o switches, you may list the files in any order.

Starting with version 1.10, tuc can also convert UNIX files, or files created under any operating system, to DOS style text files. This requires the -d or -D switch, with a subtle difference between the two. Which switch you should use depends on the operating system.

-D will always produce DOS style output.

-d produces DOS style output if outputfile is specified. However, if output is sent to stdout, tuc will produce UNIX style output. This is because tuc can be compiled as both a UNIX program and a DOS program. DOS opens the console in the cooked mode. That means, DOS appends carriage returns after all line feeds sent to the console.

You only need -D under UNIX. Under DOS, choose between -d and -D, depending on where you want to send the output.

Save the output of a UNIX program to a DOS text file:

unixprogram | tuc -D -o dostextfile

Save the output of a DOS program to a UNIX text file:

dosprogram | tuc -o unixtexfile

Filter the output of a DOS program as input to a UNIX program:

dosprogram | tuc | unixprogram

Filter the output of a UNIX program as input to a DOS program:

unixprogram | tuc -D | dosprogram

cat(1), more(1)

Both tuc and this manual page were written by G. Adam Stanislav <adam@whizkidtech.net>.

16 March 1999

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.