## 21.13. Text Conversion with dd

Besides the other uses of dd (Section 21.6) we've covered, you also can use this versatile utility to convert:

- fixed length to variable-length records (conv=unblock), and the reverse (conv=block)

- uppercase to lowercase (conv=lcase), and the reverse (conv=ucase)

- the byte order of every pair of bytes (conv=swab)

- ASCII to EBCDIC and the reverse (conv=ebcdic, conv=ibm). If you're converting old IBM tapes, you'll need to know the tape's blocking factor. And if the tape has multiple files on it, you'll have to use the tape device name that allows "no rewind on close" (Section 38.5) to read past the first file.

The `cbs=` option must be used to specify a conversion buffer size when using block and unblock and when converting between ASCII and EBCDIC. The specified number of characters are put into the conversion buffer. For ascii and unblock conversion, trailing blanks are trimmed and a newline is added to each buffer before it is output. For ebcdic, ibm, and block, the input is padded with blanks up to the specified conversion buffer size.

-- TOR

Copyright © 2003 O'Reilly & Associates. All rights reserved.