конвертировать и копировать файл (convert and copy a file)
Операнды (Operands)
All of the operands shall be processed before any input is read.
The following operands shall be supported:
if
=file Specify the input pathname; the default is standard
input.
of
=file Specify the output pathname; the default is standard
output. If the seek
=expr conversion is not also
specified, the output file shall be truncated before
the copy begins if an explicit of
=file operand is
specified, unless conv
=notrunc
is specified. If
seek
=expr is specified, but conv
=notrunc
is not, the
effect of the copy shall be to preserve the blocks in
the output file over which dd seeks, but no other
portion of the output file shall be preserved. (If the
size of the seek plus the size of the input file is
less than the previous size of the output file, the
output file shall be shortened by the copy. If the
input file is empty and either the size of the seek is
greater than the previous size of the output file or
the output file did not previously exist, the size of
the output file shall be set to the file offset after
the seek.)
ibs
=expr Specify the input block size, in bytes, by expr
(default is 512).
obs
=expr Specify the output block size, in bytes, by expr
(default is 512).
bs
=expr Set both input and output block sizes to expr bytes,
superseding ibs
= and obs
=. If no conversion other than
sync
, noerror
, and notrunc
is specified, each input
block shall be copied to the output as a single block
without aggregating short blocks.
cbs
=expr Specify the conversion block size for block
and unblock
in bytes by expr (default is zero). If cbs
= is omitted
or given a value of zero, using block
or unblock
produces unspecified results.
The application shall ensure that this operand is also
specified if the conv
= operand is specified with a
value of ascii
, ebcdic
, or ibm
. For a conv
= operand
with an ascii
value, the input is handled as described
for the unblock
value, except that characters are
converted to ASCII before any trailing <space>
characters are deleted. For conv
= operands with ebcdic
or ibm
values, the input is handled as described for
the block
value except that the characters are
converted to EBCDIC or IBM EBCDIC, respectively, after
any trailing <space> characters are added.
skip
=n Skip n input blocks (using the specified input block
size) before starting to copy. On seekable files, the
implementation shall read the blocks or seek past them;
on non-seekable files, the blocks shall be read and the
data shall be discarded.
seek
=n Skip n blocks (using the specified output block size)
from the beginning of the output file before copying.
On non-seekable files, existing blocks shall be read
and space from the current end-of-file to the specified
offset, if any, filled with null bytes; on seekable
files, the implementation shall seek to the specified
offset or read the blocks as described for non-seekable
files.
count
=n Copy only n input blocks. If n is zero, it is
unspecified whether no blocks or all blocks are copied.
conv
=value[
,value ...]
Where values are <comma>-separated symbols from the
following list:
ascii
Convert EBCDIC to ASCII; see Table 4-7, ASCII
to EBCDIC Conversion.
ebcdic
Convert ASCII to EBCDIC; see Table 4-7, ASCII
to EBCDIC Conversion.
ibm
Convert ASCII to a different EBCDIC set; see
Table 4-8, ASCII to IBM EBCDIC Conversion.
The ascii
, ebcdic
, and ibm
values are mutually-
exclusive.
block
Treat the input as a sequence of
<newline>-terminated or end-of-file-terminated
variable-length records independent of the
input block boundaries. Each record shall be
converted to a record with a fixed length
specified by the conversion block size. Any
<newline> shall be removed from the input
line; <space> characters shall be appended to
lines that are shorter than their conversion
block size to fill the block. Lines that are
longer than the conversion block size shall be
truncated to the largest number of characters
that fit into that size; the number of
truncated lines shall be reported (see the
STDERR section).
The block
and unblock
values are mutually-
exclusive.
unblock
Convert fixed-length records to variable
length. Read a number of bytes equal to the
conversion block size (or the number of bytes
remaining in the input, if less than the
conversion block size), delete all trailing
<space> characters, and append a <newline>.
lcase
Map uppercase characters specified by the
LC_CTYPE keyword tolower
to the corresponding
lowercase character. Characters for which no
mapping is specified shall not be modified by
this conversion.
The lcase
and ucase
symbols are mutually-
exclusive.
ucase
Map lowercase characters specified by the
LC_CTYPE keyword toupper
to the corresponding
uppercase character. Characters for which no
mapping is specified shall not be modified by
this conversion.
swab
Swap every pair of input bytes.
noerror
Do not stop processing on an input error. When
an input error occurs, a diagnostic message
shall be written on standard error, followed
by the current input and output block counts
in the same format as used at completion (see
the STDERR section). If the sync
conversion is
specified, the missing input shall be replaced
with null bytes and processed normally;
otherwise, the input block shall be omitted
from the output.
notrunc
Do not truncate the output file. Preserve
blocks in the output file not explicitly
written by this invocation of the dd utility.
(See also the preceding of
=file operand.)
sync
Pad every input block to the size of the ibs
=
buffer, appending null bytes. (If either block
or unblock
is also specified, append <space>
characters, rather than null bytes.)
The behavior is unspecified if operands other than conv
= are
specified more than once.
For the bs
=, cbs
=, ibs
=, and obs
= operands, the application shall
supply an expression specifying a size in bytes. The expression,
expr, can be:
1. A positive decimal number
2. A positive decimal number followed by k, specifying
multiplication by 1024
3. A positive decimal number followed by b, specifying
multiplication by 512
4. Two or more positive decimal numbers (with or without k or b)
separated by x, specifying the product of the indicated
values
All of the operands are processed before any input is read.
The following two tables display the octal number character
values used for the ascii
and ebcdic
conversions (first table)
and for the ibm
conversion (second table). In both tables, the
ASCII values are the row and column headers and the EBCDIC values
are found at their intersections. For example, ASCII 0012 (LF) is
the second row, third column, yielding 0045 in EBCDIC. The
inverted tables (for EBCDIC to ASCII conversion) are not shown,
but are in one-to-one correspondence with these tables. The
differences between the two tables are highlighted by small boxes
drawn around five entries.
Table 4-7: ASCII to EBCDIC Conversion
Table 4-8: ASCII to IBM EBCDIC Conversion