mdoc version three/bds copyright
[unix-history] / usr / src / bin / dd / dd.1
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.roff%
.\"
.\" @(#)dd.1 6.4 (Berkeley) %G%
.\"
.Dd
.Dt DD 1
.Os
.Sh NAME
.Nm dd
.Nd convert and copy a file
.Sh SYNOPSIS
.Nm dd
.Op options ...
.Sh DESCRIPTION
The
.Nm
utility copies the specified input file to the specified
output with possible conversions.
.Pp
The following options are available:
.Bl -tag -width of=file
.It Cm if= Ns Ar file
Input pathname; standard input is
default.
.It Cm of= Ns Ar file
Output pathname; standard output is
default.
.It Cm ibs= Ns Ar n
Input block size
.Va n
bytes (default is
512 bytes).
.It Cm obs= Ns Ar n
Output block size (default is 512 bytes).
.It Cm bs= Ns Ar n
Set both input and output block size,
superseding
.Cm ibs
and
.Cm obs .
.It Cm cbs= Ns Ar n
Conversion buffer size
.It Cm skip= Ns Ar n
Skip
.Va n
input blocks (each block is the
size of
.Cm ibs )
before starting copy.
.It Cm seek= Ns Ar n
Seek
.Ar n
blocks (each block is the size of
obs) from beginning of output file before
copying.
.It Cm count= Ns Ar n
Copy only
.Va n
input blocks.
.It Xo
.Cm conv=
.Ns Ar value Ns Op \&, Ar value \&...
.Xc
Where values are comma-separated symbols
from the following list.
.Bl -tag -width unblock
.It Ar block
Convert variable length records to fixed
length.
Read characters into the
.Ar cbs
buffer, delete a trailing <newline>, and
pad to the length of the
.Ar cbs
buffer with
<space>s.
Both
.Ar block
and
.Ar unblock
are mutually
exclusive.
.It Ar unblock
Convert fixed length records to variable
length.
Read a number of characters
equal to the size of the
.Ar cbs
buffer,
delete all trailing <blank>s, and append
a <newline>.
.It Ar lcase
Map characters in the alpha character
classification from class upper to the
corresponding value in class lower.
Both
.Ar lcase
and
.Ar ucase
are mutually exclusive.
.It Ar ucase
Map characters in the alpha character
classification from class lower to the
corresponding value in class upper.
.It Ar swab
Swap every pair of bytes
.It Ar noerror
Do not stop processing on an error.
.It Ar sync
Pad every input block to the size of
.Ar ibs
buffer, appending <space> characters.
.El
.El
.Pp
Where sizes are specified, a decimal number of bytes is
expected.
A size can end with
.Cm k
or
.Cm b
to specify multiplication
by 1024 or 512, respectively.
A pair of sizes can be
separated by
.Cm x
to indicate a product.
.Pp
If the option
.Cm if=
is not specified, the standard input is used.
.Pp
The input files can be any file type and
on completion,
.Nm
writes the number of input and output
blocks, full and partial counts, to the standard error.
.Pp
A partial block may be caused by a read or write operation
transferring less than
.Cm ibs
bytes.
Only bytes read
have conversions, as specified by the options, applied to
them.
.Pp
For
.Dv SIGINT ,
the
.Nm
utility writes status information to
standard error before exiting.
It takes the default action
for all other signals.
.Pp
The
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Pp
If an error is detected, and the noerror option has not
been supplied, the cause is reported and the
.Nm
utility
aborts the copy of the file.
.Sh SEE ALSO
.Xr tr 1
.Sh STANDARDS
The
.Nm
utility is expected to be
.St -p1003.2
compatible.