| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These commands read and write entire files, possibly transforming them in some way.
3.1 cat: Concatenate and write files | Concatenate and write files. | |
3.2 tac: Concatenate and write files in reverse | Concatenate and write files in reverse. | |
3.3 nl: Number lines and write files | Number lines and write files. | |
3.4 od: Write files in octal or other formats | Write files in octal or other formats. | |
3.5 base64: Transform data into printable data | Transform data into printable data. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cat: Concatenate and write files cat copies each file (`-' means standard input), or
standard input if none are given, to standard output. Synopsis:
cat [option] [file]… |
The program accepts the following options. Also see Common options.
Equivalent to `-vET'.
Number all nonempty output lines, starting with 1.
Equivalent to `-vE'.
Display a `$' after the end of each line.
Number all output lines, starting with 1.
Suppress repeated adjacent empty lines; output just one empty line instead of several.
Equivalent to `-vT'.
Display TAB characters as `^I'.
Ignored; for POSIX compatibility.
Display control characters except for LFD and TAB using `^' notation and precede characters that have the high bit set with `M-'.
On systems like MS-DOS that distinguish between text and binary files,
cat normally reads and writes in binary mode. However,
cat reads in text mode if one of the options
`-bensAE' is used or if cat is reading from standard
input and standard input is a terminal. Similarly, cat
writes in text mode if one of the options `-bensAE' is used or
if standard output is a terminal.
An exit status of zero indicates success, and a nonzero value indicates failure.
Examples:
# Output f's contents, then standard input, then g's contents. cat f - g # Copy standard input to standard output. cat |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
tac: Concatenate and write files in reverse tac copies each file (`-' means standard input), or
standard input if none are given, to standard output, reversing the
records (lines by default) in each separately. Synopsis:
tac [option]… [file]… |
Records are separated by instances of a string (newline by default). By default, this separator string is attached to the end of the record that it follows in the file.
The program accepts the following options. Also see Common options.
The separator is attached to the beginning of the record that it precedes in the file.
Treat the separator string as a regular expression. Users of tac
on MS-DOS/MS-Windows should note that, since tac reads files in
binary mode, each line of a text file might end with a CR/LF pair
instead of the Unix-style LF.
Use separator as the record separator, instead of newline.
An exit status of zero indicates success, and a nonzero value indicates failure.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
nl: Number lines and write files nl writes each file (`-' means standard input), or
standard input if none are given, to standard output, with line numbers
added to some or all of the lines. Synopsis:
nl [option]… [file]… |
nl decomposes its input into (logical) pages; by default, the
line number is reset to 1 at the top of each logical page. nl
treats all of the input files as a single document; it does not reset
line numbers or logical pages between files.
A logical page consists of three sections: header, body, and footer. Any of the sections can be empty. Each can be numbered in a different style from the others.
The beginnings of the sections of logical pages are indicated in the input file by a line containing exactly one of these delimiter strings:
start of header;
start of body;
start of footer.
The two characters from which these strings are made can be changed from `\' and `:' via options (see below), but the pattern and length of each string cannot be changed.
A section delimiter is replaced by an empty line on output. Any text
that comes before the first section delimiter string in the input file
is considered to be part of a body section, so nl treats a
file that contains no section delimiters as a single body section.
The program accepts the following options. Also see Common options.
Select the numbering style for lines in the body section of each logical page. When a line is not numbered, the current line number is not incremented, but the line number separator character is still prepended to the line. The styles are:
number all lines,
number only nonempty lines (default for body),
do not number lines (default for header and footer),
number only lines that contain a match for the basic regular expression bre. See (grep)Regular Expressions section `Regular Expressions' in The GNU Grep Manual.
Set the section delimiter characters to cd; default is `\:'. If only c is given, the second remains `:'. (Remember to protect `\' or other metacharacters from shell expansion with quotes or extra backslashes.)
Analogous to `--body-numbering'.
Analogous to `--body-numbering'.
Increment line numbers by number (default 1).
Consider number (default 1) consecutive empty lines to be one logical line for numbering, and only number the last one. Where fewer than number consecutive empty lines occur, do not number them. An empty line is one that contains no characters, not even spaces or tabs.
Select the line numbering format (default is rn):
left justified, no leading zeros;
right justified, no leading zeros;
right justified, leading zeros.
Do not reset the line number at the start of a logical page.
Separate the line number from the text line in the output with string (default is the TAB character).
Set the initial line number on each logical page to number (default 1).
Use number characters for line numbers (default 6).
An exit status of zero indicates success, and a nonzero value indicates failure.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
od: Write files in octal or other formats od writes an unambiguous representation of each file
(`-' means standard input), or standard input if none are given.
Synopses:
od [option]… [file]… od [-abcdfilosx]… [file] [[+]offset[.][b]] od [option]… --traditional [file] [[+]offset[.][b] [[+]label[.][b]]] |
Each line of output consists of the offset in the input, followed by
groups of data from the file. By default, od prints the offset in
octal, and each group of file data is a C short int's worth of input
printed as a single octal number.
If offset is given, it specifies how many input bytes to skip before formatting and writing. By default, it is interpreted as an octal number, but the optional trailing decimal point causes it to be interpreted as decimal. If no decimal is specified and the offset begins with `0x' or `0X' it is interpreted as a hexadecimal number. If there is a trailing `b', the number of bytes skipped will be offset multiplied by 512.
If a command is of both the first and second forms, the second form is assumed if the last operand begins with `+' or (if there are two operands) a digit. For example, in `od foo 10' and `od +10' the `10' is an offset, whereas in `od 10' the `10' is a file name.
The program accepts the following options. Also see Common options.
Select the base in which file offsets are printed. radix can be one of the following:
decimal;
octal;
hexadecimal;
none (do not print offsets).
The default is octal.
Skip bytes input bytes before formatting and writing. If bytes begins with `0x' or `0X', it is interpreted in hexadecimal; otherwise, if it begins with `0', in octal; otherwise, in decimal. bytes may be, or may be an integer optionally followed by, one of the following multiplicative suffixes:
`b' => 512 ("blocks")
`KB' => 1000 (KiloBytes)
`K' => 1024 (KibiBytes)
`MB' => 1000*1000 (MegaBytes)
`M' => 1024*1024 (MebiBytes)
`GB' => 1000*1000*1000 (GigaBytes)
`G' => 1024*1024*1024 (GibiBytes)
|
and so on for `T', `P', `E', `Z', and `Y'.
Output at most bytes bytes of the input. Prefixes and suffixes on
bytes are interpreted as for the `-j' option.
Instead of the normal output, output only string constants: at
least bytes consecutive ASCII graphic characters,
followed by a zero byte (ASCII NUL).
Prefixes and suffixes on bytes are interpreted as for the
`-j' option.
If n is omitted with `--strings', the default is 3.
Select the format in which to output the file data. type is a
string of one or more of the below type indicator characters. If you
include more than one type indicator character in a single type
string, or use this option more than once, od writes one copy
of each output line using each of the data types that you specified,
in the order that you specified.
Adding a trailing "z" to any type specification appends a display of the ASCII character representation of the printable characters to the output line generated by the type specification.
named character, ignoring high-order bit
ASCII character or backslash escape,
signed decimal
floating point
octal
unsigned decimal
hexadecimal
The type a outputs things like `sp' for space, `nl' for
newline, and `nul' for a zero byte. Only the least significant
seven bits of each byte is used; the high-order bit is ignored.
Type c outputs
` ', `\n', and \0, respectively.
Except for types `a' and `c', you can specify the number of bytes to use in interpreting each number in the given data type by following the type indicator character with a decimal integer. Alternately, you can specify the size of one of the C compiler's built-in data types by following the type indicator character with one of the following characters. For integers (`d', `o', `u', `x'):
char
short
int
long
For floating point (f):
float
double
long double
Output consecutive lines that are identical. By default, when two or
more consecutive output lines would be identical, od outputs only
the first line, and puts just an asterisk on the following line to
indicate the elision.
Dump n input bytes per output line. This must be a multiple of
the least common multiple of the sizes associated with the specified
output types.
If this option is not given at all, the default is 16. If n is omitted, the default is 32.
The next several options are shorthands for format specifications.
GNU od accepts any combination of shorthands and format
specification options. These options accumulate.
Output as named characters. Equivalent to `-t a'.
Output as octal bytes. Equivalent to `-t o1'.
Output as ASCII characters or backslash escapes. Equivalent to `-t c'.
Output as unsigned decimal two-byte units. Equivalent to `-t u2'.
Output as floats. Equivalent to `-t fF'.
Output as decimal ints. Equivalent to `-t dI'.
Output as decimal long ints. Equivalent to `-t dL'.
Output as octal two-byte units. Equivalent to `-t o2'.
Output as decimal two-byte units. Equivalent to `-t d2'.
Output as hexadecimal two-byte units. Equivalent to `-t x2'.
Recognize the non-option label argument that traditional od
accepted. The following syntax:
od --traditional [file] [[+]offset[.][b] [[+]label[.][b]]] |
can be used to specify at most one file and optional arguments specifying an offset and a pseudo-start address, label. The label argument is interpreted just like offset, but it specifies an initial pseudo-address. The pseudo-addresses are displayed in parentheses following any normal address.
An exit status of zero indicates success, and a nonzero value indicates failure.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
base64: Transform data into printable data base64 transforms data read from a file, or standard input,
into (or from) base64 encoded form. The base64 encoded form uses
printable ASCII characters to represent binary data.
Synopses:
base64 [option]… [file] base64 --decode [option]… [file] |
The base64 encoding expands data to roughly 133% of the original. The format conforms to RFC 4648.
The program accepts the following options. Also see Common options.
During encoding, wrap lines after cols characters. This must be a positive number.
The default is to wrap after 76 characters. Use the value 0 to disable line wrapping altogether.
Change the mode of operation, from the default of encoding data, to decoding data. Input is expected to be base64 encoded data, and the output will be the original data.
When decoding, newlines are always accepted. During decoding, ignore unrecognized bytes, to permit distorted data to be decoded.
An exit status of zero indicates success, and a nonzero value indicates failure.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January, 20 2010 using texi2html 1.76.