Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
TUC(1)			FreeBSD	General	Commands Manual			TUC(1)

NAME
     tuc -- Text to Unix Conversion (v1.10)

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

DESCRIPTION
     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.

USAGE
   Converting to UNIX
     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.

   Converting to DOS
     Starting with version 1.10, tuc can also convert UNIX files, or files
     created under any operating system, to DOS	style text files. This re-
     quires 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 out-
     put is sent to stdout, tuc	will produce UNIX style	output.	This is	be-
     cause 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, depend-
     ing on where you want to send the output.

   Examples
     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

SEE ALSO
     cat(1), more(1)

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

				 16 March 1999

NAME | SYNOPSIS | DESCRIPTION | USAGE | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=tuc&sektion=1&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help