home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / textutils-1.19-bin.lha / info / textutils.info-1 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  43KB  |  873 lines

  1. This is Info file textutils.info, produced by Makeinfo-1.64 from the
  2. input file /ade-src/fsf/textutils/doc/textutils.texi.
  3. START-INFO-DIR-ENTRY
  4. * Text utilities: (textutils).          GNU text utilities.
  5. * cat: (textutils)cat invocation.               Concatenate and write files.
  6. * cksum: (textutils)cksum invocation.           Print POSIX CRC checksum.
  7. * comm: (textutils)comm invocation.             Compare sorted files by line.
  8. * csplit: (textutils)csplit invocation.         Split by context.
  9. * cut: (textutils)cut invocation.               Print selected parts of lines.
  10. * expand: (textutils)expand invocation.         Convert tabs to spaces.
  11. * fmt: (textutils)fmt invocation.               Reformat paragraph text.
  12. * fold: (textutils)fold invocation.             Wrap long input lines.
  13. * head: (textutils)head invocation.             Output the first part of files.
  14. * join: (textutils)join invocation.             Join lines on a common field.
  15. * md5sum: (textutils)md5sum invocation.         Print or check message-digests.
  16. * nl: (textutils)nl invocation.                 Number lines and write files.
  17. * od: (textutils)od invocation.                 Dump files in octal, etc.
  18. * paste: (textutils)paste invocation.           Merge lines of files.
  19. * pr: (textutils)pr invocation.                 Paginate or columnate files.
  20. * sort: (textutils)sort invocation.             Sort text files.
  21. * split: (textutils)split invocation.           Split into fixed-size pieces.
  22. * sum: (textutils)sum invocation.               Print traditional checksum.
  23. * tac: (textutils)tac invocation.               Reverse files.
  24. * tail: (textutils)tail invocation.             Output the last part of files.
  25. * tr: (textutils)tr invocation.                 Translate characters.
  26. * unexpand: (textutils)unexpand invocation.     Convert spaces to tabs.
  27. * uniq: (textutils)uniq invocation.             Uniqify files.
  28. * wc: (textutils)wc invocation.                 Byte, word, and line counts.
  29. END-INFO-DIR-ENTRY
  30.    This file documents the GNU text utilities.
  31.    Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
  32.    Permission is granted to make and distribute verbatim copies of this
  33. manual provided the copyright notice and this permission notice are
  34. preserved on all copies.
  35.    Permission is granted to copy and distribute modified versions of
  36. this manual under the conditions for verbatim copying, provided that
  37. the entire resulting derived work is distributed under the terms of a
  38. permission notice identical to this one.
  39.    Permission is granted to copy and distribute translations of this
  40. manual into another language, under the above conditions for modified
  41. versions, except that this permission notice may be stated in a
  42. translation approved by the Foundation.
  43. File: textutils.info,  Node: Top,  Next: Introduction,  Up: (dir)
  44. GNU text utilities
  45. ******************
  46.    This manual minimally documents version 1.19 of the GNU text
  47. utilities.
  48. * Menu:
  49. * Introduction::                       Caveats, overview, and authors.
  50. * Common options::                     Common options.
  51. * Output of entire files::             cat tac nl od
  52. * Formatting file contents::           fmt pr fold
  53. * Output of parts of files::           head tail split csplit
  54. * Summarizing files::                  wc sum cksum md5sum
  55. * Operating on sorted files::          sort uniq comm
  56. * Operating on fields within a line::  cut paste join
  57. * Operating on characters::            tr expand unexpand
  58. * Opening the software toolbox::       The software tools philosophy.
  59. * Index::                              General index.
  60. File: textutils.info,  Node: Introduction,  Next: Common options,  Prev: Top,  Up: Top
  61. Introduction
  62. ************
  63.    This manual is incomplete: No attempt is made to explain basic
  64. concepts in a way suitable for novices.  Thus, if you are interested,
  65. please get involved in improving this manual.  The entire GNU community
  66. will benefit.
  67.    The GNU text utilities are mostly compatible with the POSIX.2
  68. standard.
  69.    Please report bugs to `bug-gnu-utils@prep.ai.mit.edu'.  Remember to
  70. include the version number, machine architecture, input files, and any
  71. other information needed to reproduce the bug: your input, what you
  72. expected, what you got, and why it is wrong.  Diffs are welcome, but
  73. please include a description of the problem as well, since this is
  74. sometimes difficult to infer. *Note Bugs: (gcc)Bugs.
  75.    This manual is based on the Unix man pages in the distribution, which
  76. were originally written by David MacKenzie and updated by Jim Meyering.
  77. The original `fmt' man page was written by Ross Paterson.  Franc,ois
  78. Pinard did the initial conversion to Texinfo format.  Karl Berry did
  79. the indexing, some reorganization, and editing of the results.  Richard
  80. Stallman contributed his usual invaluable insights to the overall
  81. process.
  82. File: textutils.info,  Node: Common options,  Next: Output of entire files,  Prev: Introduction,  Up: Top
  83. Common options
  84. **************
  85.    Certain options are available in all these programs.  Rather than
  86. writing identical descriptions for each of the programs, they are
  87. described here.  (In fact, every GNU program accepts (or should accept)
  88. these options.)
  89.    A few of these programs take arbitrary strings as arguments.  In
  90. those cases, `--help' and `--version' are taken as these options only
  91. if there is one and exactly one command line argument.
  92. `--help'
  93.      Print a usage message listing all available options, then exit
  94.      successfully.
  95. `--version'
  96.      Print the version number, then exit successfully.
  97. File: textutils.info,  Node: Output of entire files,  Next: Formatting file contents,  Prev: Common options,  Up: Top
  98. Output of entire files
  99. **********************
  100.    These commands read and write entire files, possibly transforming
  101. them in some way.
  102. * Menu:
  103. * cat invocation::              Concatenate and write files.
  104. * tac invocation::              Concatenate and write files in reverse.
  105. * nl invocation::               Number lines and write files.
  106. * od invocation::               Write files in octal or other formats.
  107. File: textutils.info,  Node: cat invocation,  Next: tac invocation,  Up: Output of entire files
  108. `cat': Concatenate and write files
  109. ==================================
  110.    `cat' copies each FILE (`-' means standard input), or standard input
  111. if none are given, to standard output.  Synopsis:
  112.      cat [OPTION] [FILE]...
  113.    The program accepts the following options.  Also see *Note Common
  114. options::.
  115. `--show-all'
  116.      Equivalent to `-vET'.
  117. `--number-nonblank'
  118.      Number all nonblank output lines, starting with 1.
  119.      Equivalent to `-vE'.
  120. `--show-ends'
  121.      Display a `$' after the end of each line.
  122. `--number'
  123.      Number all output lines, starting with 1.
  124. `--squeeze-blank'
  125.      Replace multiple adjacent blank lines with a single blank line.
  126.      Equivalent to `-vT'.
  127. `--show-tabs'
  128.      Display TAB characters as `^I'.
  129.      Ignored; for Unix compatibility.
  130. `--show-nonprinting'
  131.      Display control characters except for LFD and TAB using `^'
  132.      notation and precede characters that have the high bit set with
  133.      `M-'.
  134. File: textutils.info,  Node: tac invocation,  Next: nl invocation,  Prev: cat invocation,  Up: Output of entire files
  135. `tac': Concatenate and write files in reverse
  136. =============================================
  137.    `tac' copies each FILE (`-' means standard input), or standard input
  138. if none are given, to standard output, reversing the records (lines by
  139. default) in each separately.  Synopsis:
  140.      tac [OPTION]... [FILE]...
  141.    "Records" are separated by instances of a string (newline by
  142. default).  By default, this separator string is attached to the end of
  143. the record that it follows in the file.
  144.    The program accepts the following options.  Also see *Note Common
  145. options::.
  146. `--before'
  147.      The separator is attached to the beginning of the record that it
  148.      precedes in the file.
  149. `--regex'
  150.      Treat the separator string as a regular expression.
  151. `-s SEPARATOR'
  152. `--separator=SEPARATOR'
  153.      Use SEPARATOR as the record separator, instead of newline.
  154. File: textutils.info,  Node: nl invocation,  Next: od invocation,  Prev: tac invocation,  Up: Output of entire files
  155. `nl': Number lines and write files
  156. ==================================
  157.    `nl' writes each FILE (`-' means standard input), or standard input
  158. if none are given, to standard output, with line numbers added to some
  159. or all of the lines.  Synopsis:
  160.      nl [OPTION]... [FILE]...
  161.    `nl' decomposes its input into (logical) pages; by default, the line
  162. number is reset to 1 at the top of each logical page.  `nl' treats all
  163. of the input files as a single document; it does not reset line numbers
  164. or logical pages between files.
  165.    A logical page consists of three sections: header, body, and footer.
  166. Any of the sections can be empty.  Each can be numbered in a different
  167. style from the others.
  168.    The beginnings of the sections of logical pages are indicated in the
  169. input file by a line containing exactly one of these delimiter strings:
  170. `\:\:\:'
  171.      start of header;
  172. `\:\:'
  173.      start of body;
  174.      start of footer.
  175.    The two characters from which these strings are made can be changed
  176. from `\' and `:' via options (see below), but the pattern and length of
  177. each string cannot be changed.
  178.    A section delimiter is replaced by an empty line on output.  Any text
  179. that comes before the first section delimiter string in the input file
  180. is considered to be part of a body section, so `nl' treats a file that
  181. contains no section delimiters as a single body section.
  182.    The program accepts the following options.  Also see *Note Common
  183. options::.
  184. `-b STYLE'
  185. `--body-numbering=STYLE'
  186.      Select the numbering style for lines in the body section of each
  187.      logical page.  When a line is not numbered, the current line number
  188.      is not incremented, but the line number separator character is
  189.      still prepended to the line.  The styles are:
  190.     `a'
  191.           number all lines,
  192.     `t'
  193.           number only nonempty lines (default for body),
  194.     `n'
  195.           do not number lines (default for header and footer),
  196.     `pREGEXP'
  197.           number only lines that contain a match for REGEXP.
  198. `-d CD'
  199. `--section-delimiter=CD'
  200.      Set the section delimiter characters to CD; default is `\:'. If
  201.      only C is given, the second remains `:'.  (Remember to protect `\'
  202.      or other metacharacters from shell expansion with quotes or extra
  203.      backslashes.)
  204. `-f STYLE'
  205. `--footer-numbering=STYLE'
  206.      Analogous to `--body-numbering'.
  207. `-h STYLE'
  208. `--header-numbering=STYLE'
  209.      Analogous to `--body-numbering'.
  210. `-i NUMBER'
  211. `--page-increment=NUMBER'
  212.      Increment line numbers by NUMBER (default 1).
  213. `-l NUMBER'
  214. `--join-blank-lines=NUMBER'
  215.      Consider NUMBER (default 1) consecutive empty lines to be one
  216.      logical line for numbering, and only number the last one.  Where
  217.      fewer than NUMBER consecutive empty lines occur, do not number
  218.      them.  An empty line is one that contains no characters, not even
  219.      spaces or tabs.
  220. `-n FORMAT'
  221. `--number-format=FORMAT'
  222.      Select the line numbering format (default is `rn'):
  223.     `ln'
  224.           left justified, no leading zeros;
  225.     `rn'
  226.           right justified, no leading zeros;
  227.     `rz'
  228.           right justified, leading zeros.
  229. `--no-renumber'
  230.      Do not reset the line number at the start of a logical page.
  231. `-s STRING'
  232. `--number-separator=STRING'
  233.      Separate the line number from the text line in the output with
  234.      STRING (default is TAB).
  235. `-v NUMBER'
  236. `--starting-line-number=NUMBER'
  237.      Set the initial line number on each logical page to NUMBER
  238.      (default 1).
  239. `-w NUMBER'
  240. `--number-width=NUMBER'
  241.      Use NUMBER characters for line numbers (default 6).
  242. File: textutils.info,  Node: od invocation,  Prev: nl invocation,  Up: Output of entire files
  243. `od': Write files in octal or other formats
  244. ===========================================
  245.    `od' writes an unambiguous representation of each FILE (`-' means
  246. standard input), or standard input if none are given.  Synopsis:
  247.      od [OPTION]... [FILE]...
  248.      od -C [FILE] [[+]OFFSET [[+]LABEL]]
  249.    Each line of output consists of the offset in the input, followed by
  250. groups of data from the file. By default, `od' prints the offset in
  251. octal, and each group of file data is two bytes of input printed as a
  252. single octal number.
  253.    The program accepts the following options.  Also see *Note Common
  254. options::.
  255. `-A RADIX'
  256. `--address-radix=RADIX'
  257.      Select the base in which file offsets are printed.  RADIX can be
  258.      one of the following:
  259.     `d'
  260.           decimal;
  261.     `o'
  262.           octal;
  263.     `x'
  264.           hexadecimal;
  265.     `n'
  266.           none (do not print offsets).
  267.      The default is octal.
  268. `-j BYTES'
  269. `--skip-bytes=BYTES'
  270.      Skip BYTES input bytes before formatting and writing.  If BYTES
  271.      begins with `0x' or `0X', it is interpreted in hexadecimal;
  272.      otherwise, if it begins with `0', in octal; otherwise, in decimal.
  273.      Appending `b' multiplies BYTES by 512, `k' by 1024, and `m' by
  274.      1048576.
  275. `-N BYTES'
  276. `--read-bytes=BYTES'
  277.      Output at most BYTES bytes of the input.  Prefixes and suffixes on
  278.      `bytes' are interpreted as for the `-j' option.
  279. `-s [N]'
  280. `--strings[=N]'
  281.      Instead of the normal output, output only "string constants": at
  282.      least N (3 by default) consecutive ASCII graphic characters,
  283.      followed by a null (zero) byte.
  284. `-t TYPE'
  285. `--format=TYPE'
  286.      Select the format in which to output the file data.  TYPE is a
  287.      string of one or more of the below type indicator characters.  If
  288.      you include more than one type indicator character in a single TYPE
  289.      string, or use this option more than once, `od' writes one copy of
  290.      each output line using each of the data types that you specified,
  291.      in the order that you specified.
  292.     `a'
  293.           named character,
  294.     `c'
  295.           ASCII character or backslash escape,
  296.     `d'
  297.           signed decimal,
  298.     `f'
  299.           floating point,
  300.     `o'
  301.           octal,
  302.     `u'
  303.           unsigned decimal,
  304.     `x'
  305.           hexadecimal.
  306.      The type `a' outputs things like `sp' for space, `nl' for newline,
  307.      and `nul' for a null (zero) byte.  Type `c' outputs ` ', `\n', and
  308.      `\0', respectively.
  309.      Except for types `a' and `c', you can specify the number of bytes
  310.      to use in interpreting each number in the given data type by
  311.      following the type indicator character with a decimal integer.
  312.      Alternately, you can specify the size of one of the C compiler's
  313.      built-in data types by following the type indicator character with
  314.      one of the following characters.  For integers (`d', `o', `u',
  315.      `x'):
  316.     `C'
  317.           char,
  318.     `S'
  319.           short,
  320.     `I'
  321.           int,
  322.     `L'
  323.           long.
  324.      For floating point (`f'):
  325.     F
  326.           float,
  327.     D
  328.           double,
  329.     L
  330.           long double.
  331. `--output-duplicates'
  332.      Output consecutive lines that are identical.  By default, when two
  333.      or more consecutive output lines would be identical, `od' outputs
  334.      only the first line, and puts just an asterisk on the following
  335.      line to indicate the elision.
  336. `-w[N]'
  337. `--width[=N]'
  338.      Dump `n' input bytes per output line.  This must be a multiple of
  339.      the least common multiple of the sizes associated with the
  340.      specified output types.  If N is omitted, the default is 32.  If
  341.      this option is not given at all, the default is 16.
  342.    The next several options map the old, pre-POSIX format specification
  343. options to the corresponding POSIX format specs.  GNU `od' accepts any
  344. combination of old- and new-style options.  Format specification
  345. options accumulate.
  346.      Output as named characters.  Equivalent to `-ta'.
  347.      Output as octal bytes.  Equivalent to `-toC'.
  348.      Output as ASCII characters or backslash escapes.  Equivalent to
  349.      `-tc'.
  350.      Output as unsigned decimal shorts.  Equivalent to `-tu2'.
  351.      Output as floats.  Equivalent to `-tfF'.
  352.      Output as hexadecimal shorts.  Equivalent to `-tx2'.
  353.      Output as decimal shorts.  Equivalent to `-td2'.
  354.      Output as decimal longs.  Equivalent to `-td4'.
  355.      Output as octal shorts.  Equivalent to `-to2'.
  356.      Output as hexadecimal shorts.  Equivalent to `-tx2'.
  357. `--traditional'
  358.      Recognize the pre-POSIX non-option arguments that traditional `od'
  359.      accepted.  The following syntax:
  360.           od --traditional [FILE] [[+]OFFSET[.][b] [[+]LABEL[.][b]]]
  361.      can be used to specify at most one file and optional arguments
  362.      specifying an offset and a pseudo-start address, LABEL.  By
  363.      default, OFFSET is interpreted as an octal number specifying how
  364.      many input bytes to skip before formatting and writing.  The
  365.      optional trailing decimal point forces the interpretation of
  366.      OFFSET as a decimal number.  If no decimal is specified and the
  367.      offset begins with `0x' or `0X' it is interpreted as a hexadecimal
  368.      number.  If there is a trailing `b', the number of bytes skipped
  369.      will be OFFSET multiplied by 512.  The LABEL argument is
  370.      interpreted just like OFFSET, but it specifies an initial
  371.      pseudo-address.  The pseudo-addresses are displayed in parentheses
  372.      following any normal address.
  373. File: textutils.info,  Node: Formatting file contents,  Next: Output of parts of files,  Prev: Output of entire files,  Up: Top
  374. Formatting file contents
  375. ************************
  376.    These commands reformat the contents of files.
  377. * Menu:
  378. * fmt invocation::              Reformat paragraph text.
  379. * pr invocation::               Paginate or columnate files for printing.
  380. * fold invocation::             Wrap input lines to fit in specified width.
  381. File: textutils.info,  Node: fmt invocation,  Next: pr invocation,  Up: Formatting file contents
  382. `fmt': Reformat paragraph text
  383. ==============================
  384.    `fmt' fills and joins lines to produce output lines of (at most) a
  385. given number of characters (75 by default).  Synopsis:
  386.      fmt [OPTION]... [FILE]...
  387.    `fmt' reads from the specified FILE arguments (or standard input if
  388. none are given), and writes to standard output.
  389.    By default, blank lines, spaces between words, and indentation are
  390. preserved in the output; successive input lines with different
  391. indentation are not joined; tabs are expanded on input and introduced on
  392. output.
  393.    `fmt' prefers breaking lines at the end of a sentence, and tries to
  394. avoid line breaks after the first word of a sentence or before the last
  395. word of a sentence.  A "sentence break" is defined as either the end of
  396. a paragraph or a word ending in any of `.?!', followed by two spaces or
  397. end of line, ignoring any intervening parentheses or quotes.  Like TeX,
  398. `fmt' reads entire "paragraphs" before choosing line breaks; the
  399. algorithm is a variant of that in "Breaking Paragraphs Into Lines"
  400. (Donald E. Knuth and Michael F. Plass, `Software--Practice and
  401. Experience', 11 (1981), 1119-1184).
  402.    The program accepts the following options.  Also see *Note Common
  403. options::.
  404. `--crown-margin'
  405.      "Crown margin" mode: preserve the indentation of the first two
  406.      lines within a paragraph, and align the left margin of each
  407.      subsequent line with that of the second line.
  408. `--tagged-paragraph'
  409.      "Tagged paragraph" mode: like crown margin mode, except that if
  410.      indentation of the first line of a paragraph is the same as the
  411.      indentation of the second, the first line is treated as a one-line
  412.      paragraph.
  413. `--split-only'
  414.      Split lines only.  Do not join short lines to form longer ones.
  415.      This prevents sample lines of code, and other such "formatted"
  416.      text from being unduly combined.
  417. `--uniform-spacing'
  418.      Uniform spacing.  Reduce spacing between words to one space, and
  419.      spacing between sentences to two spaces.
  420. `-WIDTH'
  421. `-w WIDTH'
  422. `--width=WIDTH'
  423.      Fill output lines up to WIDTH characters (default 75).  `fmt'
  424.      initially tries to make lines about 7% shorter than this, to give
  425.      it room to balance line lengths.
  426. `-p PREFIX'
  427. `--prefix=PREFIX'
  428.      Only lines beginning with PREFIX (possibly preceded by whitespace)
  429.      are subject to formatting. The prefix and any preceding whitespace
  430.      are stripped for the formatting and then re-attached to each
  431.      formatted output line.  One use is to format certain kinds of
  432.      program comments, while leaving the code unchanged.
  433. File: textutils.info,  Node: pr invocation,  Next: fold invocation,  Prev: fmt invocation,  Up: Formatting file contents
  434. `pr': Paginate or columnate files for printing
  435. ==============================================
  436.    `pr' writes each FILE (`-' means standard input), or standard input
  437. if none are given, to standard output, paginating and optionally
  438. outputting in multicolumn format.  Synopsis:
  439.      pr [OPTION]... [FILE]...
  440.    By default, a 5-line header is printed: two blank lines; a line with
  441. the date, the file name, and the page count; and two more blank lines.
  442. A five line footer (entirely) is also printed.
  443.    Form feeds in the input cause page breaks in the output.
  444.    The program accepts the following options.  Also see *Note Common
  445. options::.
  446. `+PAGE'
  447.      Begin printing with page PAGE.
  448. `-COLUMN'
  449.      Produce COLUMN-column output and print columns down.  The column
  450.      width is automatically decreased as COLUMN increases; unless you
  451.      use the `-w' option to increase the page width as well, this option
  452.      might well cause some input to be truncated.
  453.      Print columns across rather than down.
  454.      Balance columns on the last page.
  455.      Print control characters using hat notation (e.g., `^G'); print
  456.      other unprintable characters in octal backslash notation.  By
  457.      default, unprintable characters are not changed.
  458.      Double space the output.
  459. `-e[IN-TABCHAR[IN-TABWIDTH]]'
  460.      Expand tabs to spaces on input.  Optional argument IN-TABCHAR is
  461.      the input tab character (default is TAB).  Second optional
  462.      argument IN-TABWIDTH is the input tab character's width (default
  463.      is 8).
  464.      Use a formfeed instead of newlines to separate output pages.
  465. `-h HEADER'
  466.      Replace the file name in the header with the string HEADER.
  467. `-i[OUT-TABCHAR[OUT-TABWIDTH]]'
  468.      Replace spaces with tabs on output.  Optional argument OUT-TABCHAR
  469.      is the output tab character (default is TAB).  Second optional
  470.      argument OUT-TABWIDTH is the output tab character's width (default
  471.      is 8).
  472. `-l N'
  473.      Set the page length to N (default 66) lines.  If N is less than
  474.      10, the headers and footers are omitted, as if the `-t' option had
  475.      been given.
  476.      Print all files in parallel, one in each column.
  477. `-n[NUMBER-SEPARATOR[DIGITS]]'
  478.      Precede each column with a line number; with parallel files (`-m'),
  479.      precede each line with a line number.  Optional argument
  480.      NUMBER-SEPARATOR is the character to print after each number
  481.      (default is TAB).  Optional argument DIGITS is the number of
  482.      digits per line number (default is 5).
  483. `-o N'
  484.      Indent each line with N (default is zero) spaces wide, i.e., set
  485.      the left margin.  The total page width is `n' plus the width set
  486.      with the `-w' option.
  487.      Do not print a warning message when an argument FILE cannot be
  488.      opened.  (The exit status will still be nonzero, however.)
  489. `-s[C]'
  490.      Separate columns by the single character C.  If C is omitted, the
  491.      default is space; if this option is omitted altogether, the
  492.      default is TAB.
  493.      Do not print the usual 5-line header and the 5-line footer on each
  494.      page, and do not fill out the bottoms of pages (with blank lines or
  495.      formfeeds).
  496.      Print unprintable characters in octal backslash notation.
  497. `-w N'
  498.      Set the page width to N (default is 72) columns.
  499. File: textutils.info,  Node: fold invocation,  Prev: pr invocation,  Up: Formatting file contents
  500. `fold': Wrap input lines to fit in specified width
  501. ==================================================
  502.    `fold' writes each FILE (`-' means standard input), or standard
  503. input if none are given, to standard output, breaking long lines.
  504. Synopsis:
  505.      fold [OPTION]... [FILE]...
  506.    By default, `fold' breaks lines wider than 80 columns. The output is
  507. split into as many lines as necessary.
  508.    `fold' counts screen columns by default; thus, a tab may count more
  509. than one column, backspace decreases the column count, and carriage
  510. return sets the column to zero.
  511.    The program accepts the following options.  Also see *Note Common
  512. options::.
  513. `--bytes'
  514.      Count bytes rather than columns, so that tabs, backspaces, and
  515.      carriage returns are each counted as taking up one column, just
  516.      like other characters.
  517. `--spaces'
  518.      Break at word boundaries: the line is broken after the last blank
  519.      before the maximum line length.  If the line contains no such
  520.      blanks, the line is broken at the maximum line length as usual.
  521. `-w WIDTH'
  522. `--width=WIDTH'
  523.      Use a maximum line length of WIDTH columns instead of 80.
  524. File: textutils.info,  Node: Output of parts of files,  Next: Summarizing files,  Prev: Formatting file contents,  Up: Top
  525. Output of parts of files
  526. ************************
  527.    These commands output pieces of the input.
  528. * Menu:
  529. * head invocation::             Output the first part of files.
  530. * tail invocation::             Output the last part of files.
  531. * split invocation::            Split a file into fixed-size pieces.
  532. * csplit invocation::           Split a file into context-determined pieces.
  533. File: textutils.info,  Node: head invocation,  Next: tail invocation,  Up: Output of parts of files
  534. `head': Output the first part of files
  535. ======================================
  536.    `head' prints the first part (10 lines by default) of each FILE; it
  537. reads from standard input if no files are given or when given a FILE of
  538. `-'.  Synopses:
  539.      head [OPTION]... [FILE]...
  540.      head -NUMBER [OPTION]... [FILE]...
  541.    If more than one FILE is specified, `head' prints a one-line header
  542. consisting of
  543.      ==> FILE NAME <==
  544. before the output for each FILE.
  545.    `head' accepts two option formats: the new one, in which numbers are
  546. arguments to the options (`-q -n 1'), and the old one, in which the
  547. number precedes any option letters (`-1q').
  548.    The program accepts the following options.  Also see *Note Common
  549. options::.
  550. `-COUNTOPTIONS'
  551.      This option is only recognized if it is specified first.  COUNT is
  552.      a decimal number optionally followed by a size letter (`b', `k',
  553.      `m') as in `-c', or `l' to mean count by lines, or other option
  554.      letters (`cqv').
  555. `-c BYTES'
  556. `--bytes=BYTES'
  557.      Print the first BYTES bytes, instead of initial lines.  Appending
  558.      `b' multiplies BYTES by 512, `k' by 1024, and `m' by 1048576.
  559. `-n N'
  560. `--lines=N'
  561.      Output the first N lines.
  562. `--quiet'
  563. `--silent'
  564.      Never print file name headers.
  565. `--verbose'
  566.      Always print file name headers.
  567. File: textutils.info,  Node: tail invocation,  Next: split invocation,  Prev: head invocation,  Up: Output of parts of files
  568. `tail': Output the last part of files
  569. =====================================
  570.    `tail' prints the last part (10 lines by default) of each FILE; it
  571. reads from standard input if no files are given or when given a FILE of
  572. `-'.  Synopses:
  573.      tail [OPTION]... [FILE]...
  574.      tail -NUMBER [OPTION]... [FILE]...
  575.      tail +NUMBER [OPTION]... [FILE]...
  576.    If more than one FILE is specified, `tail' prints a one-line header
  577. consisting of
  578.      ==> FILE NAME <==
  579. before the output for each FILE.
  580.    GNU `tail' can output any amount of data (some other versions of
  581. `tail' cannot).  It also has no `-r' option (print in reverse), since
  582. reversing a file is really a different job from printing the end of a
  583. file; BSD `tail' (which is the one with `-r') can only reverse files
  584. that are at most as large as its buffer, which is typically 32k.  A
  585. more reliable and versatile way to reverse files is the GNU `tac'
  586. command.
  587.    `tail' accepts two option formats: the new one, in which numbers are
  588. arguments to the options (`-n 1'), and the old one, in which the number
  589. precedes any option letters (`-1' or `+1').
  590.    If any option-argument is a number N starting with a `+', `tail'
  591. begins printing with the Nth item from the start of each file, instead
  592. of from the end.
  593.    The program accepts the following options.  Also see *Note Common
  594. options::.
  595. `-COUNT'
  596. `+COUNT'
  597.      This option is only recognized if it is specified first.  COUNT is
  598.      a decimal number optionally followed by a size letter (`b', `k',
  599.      `m') as in `-c', or `l' to mean count by lines, or other option
  600.      letters (`cfqv').
  601. `-c BYTES'
  602. `--bytes=BYTES'
  603.      Output the last BYTES bytes, instead of final lines.  Appending
  604.      `b' multiplies BYTES by 512, `k' by 1024, and `m' by 1048576.
  605. `--follow'
  606.      Loop forever trying to read more characters at the end of the file,
  607.      presumably because the file is growing.  Ignored if reading from a
  608.      pipe.  If more than one file is given, `tail' prints a header
  609.      whenever it gets output from a different file, to indicate which
  610.      file that output is from.
  611. `-n N'
  612. `--lines=N'
  613.      Output the last N lines.
  614. `-quiet'
  615. `--silent'
  616.      Never print file name headers.
  617. `--verbose'
  618.      Always print file name headers.
  619. File: textutils.info,  Node: split invocation,  Next: csplit invocation,  Prev: tail invocation,  Up: Output of parts of files
  620. `split': Split a file into fixed-size pieces
  621. ============================================
  622.    `split' creates output files containing consecutive sections of
  623. INPUT (standard input if none is given or INPUT is `-').  Synopsis:
  624.      split [OPTION] [INPUT [PREFIX]]
  625.    By default, `split' puts 1000 lines of INPUT (or whatever is left
  626. over for the last section), into each output file.
  627.    The output files' names consist of PREFIX (`x' by default) followed
  628. by a group of letters `aa', `ab', and so on, such that concatenating
  629. the output files in sorted order by file name produces the original
  630. input file.  (If more than 676 output files are required, `split' uses
  631. `zaa', `zab', etc.)
  632.    The program accepts the following options.  Also see *Note Common
  633. options::.
  634. `-LINES'
  635. `-l LINES'
  636. `--lines=LINES'
  637.      Put LINES lines of INPUT into each output file.
  638. `-b BYTES'
  639. `--bytes=BYTES'
  640.      Put the first BYTES bytes of INPUT into each output file.
  641.      Appending `b' multiplies BYTES by 512, `k' by 1024, and `m' by
  642.      1048576.
  643. `-C BYTES'
  644. `--line-bytes=BYTES'
  645.      Put into each output file as many complete lines of INPUT as
  646.      possible without exceeding BYTES bytes.  For lines longer than
  647.      BYTES bytes, put BYTES bytes into each output file until less than
  648.      BYTES bytes of the line are left, then continue normally.  BYTES
  649.      has the same format as for the `--bytes' option.
  650. `--verbose=BYTES'
  651.      Write a diagnostic to standard error just before each output file
  652.      is opened.
  653. File: textutils.info,  Node: csplit invocation,  Prev: split invocation,  Up: Output of parts of files
  654. `csplit': Split a file into context-determined pieces
  655. =====================================================
  656.    `csplit' creates zero or more output files containing sections of
  657. INPUT (standard input if INPUT is `-').  Synopsis:
  658.      csplit [OPTION]... INPUT PATTERN...
  659.    The contents of the output files are determined by the PATTERN
  660. arguments, as detailed below.  An error occurs if a PATTERN argument
  661. refers to a nonexistent line of the input file (e.g., if no remaining
  662. line matches a given regular expression).  After every PATTERN has been
  663. matched, any remaining input is copied into one last output file.
  664.    By default, `csplit' prints the number of bytes written to each
  665. output file after it has been created.
  666.    The types of pattern arguments are:
  667.      Create an output file containing the input up to but not including
  668.      line N (a positive integer).  If followed by a repeat count, also
  669.      create an output file containing the next LINE lines of the input
  670.      file once for each repeat.
  671. `/REGEXP/[OFFSET]'
  672.      Create an output file containing the current line up to (but not
  673.      including) the next line of the input file that contains a match
  674.      for REGEXP.  The optional OFFSET is a `+' or `-' followed by a
  675.      positive integer.  If it is given, the input up to the matching
  676.      line plus or minus OFFSET is put into the output file, and the
  677.      line after that begins the next section of input.
  678. `%REGEXP%[OFFSET]'
  679.      Like the previous type, except that it does not create an output
  680.      file, so that section of the input file is effectively ignored.
  681. `{REPEAT-COUNT}'
  682.      Repeat the previous pattern REPEAT-COUNT additional times.
  683.      REPEAT-COUNT can either be a positive integer or an asterisk,
  684.      meaning repeat as many times as necessary until the input is
  685.      exhausted.
  686.    The output files' names consist of a prefix (`xx' by default)
  687. followed by a suffix.  By default, the suffix is an ascending sequence
  688. of two-digit decimal numbers from `00' and up to `99'.  In any case,
  689. concatenating the output files in sorted order by filename produces the
  690. original input file.
  691.    By default, if `csplit' encounters an error or receives a hangup,
  692. interrupt, quit, or terminate signal, it removes any output files that
  693. it has created so far before it exits.
  694.    The program accepts the following options.  Also see *Note Common
  695. options::.
  696. `-f PREFIX'
  697. `--prefix=PREFIX'
  698.      Use PREFIX as the output file name prefix.
  699. `-b SUFFIX'
  700. `--suffix=SUFFIX'
  701.      Use SUFFIX as the output file name suffix.  When this option is
  702.      specified, the suffix string must include exactly one
  703.      `printf(3)'-style conversion specification, possibly including
  704.      format specification flags, a field width, a precision
  705.      specifications, or all of these kinds of modifiers.  The format
  706.      letter must convert a binary integer argument to readable form;
  707.      thus, only `d', `i', `u', `o', `x', and `X' conversions are
  708.      allowed.  The entire SUFFIX is given (with the current output file
  709.      number) to `sprintf(3)' to form the file name suffixes for each of
  710.      the individual output files in turn.  If this option is used, the
  711.      `--digits' option is ignored.
  712. `-n DIGITS'
  713. `--digits=DIGITS'
  714.      Use output file names containing numbers that are DIGITS digits
  715.      long instead of the default 2.
  716. `--keep-files'
  717.      Do not remove output files when errors are encountered.
  718. `--elide-empty-files'
  719.      Suppress the generation of zero-length output files.  (In cases
  720.      where the section delimiters of the input file are supposed to
  721.      mark the first lines of each of the sections, the first output
  722.      file will generally be a zero-length file unless you use this
  723.      option.)  The output file sequence numbers always run
  724.      consecutively starting from 0, even when this option is specified.
  725. `--silent'
  726. `--quiet'
  727.      Do not print counts of output file sizes.
  728. File: textutils.info,  Node: Summarizing files,  Next: Operating on sorted files,  Prev: Output of parts of files,  Up: Top
  729. Summarizing files
  730. *****************
  731.    These commands generate just a few numbers representing entire
  732. contents of files.
  733. * Menu:
  734. * wc invocation::               Print byte, word, and line counts.
  735. * sum invocation::              Print checksum and block counts.
  736. * cksum invocation::            Print CRC checksum and byte counts.
  737. * md5sum invocation::           Print or check message-digests.
  738. File: textutils.info,  Node: wc invocation,  Next: sum invocation,  Up: Summarizing files
  739. `wc': Print byte, word, and line counts
  740. =======================================
  741.    `wc' counts the number of bytes, whitespace-separated words, and
  742. newlines in each given FILE, or standard input if none are given or for
  743. a FILE of `-'.  Synopsis:
  744.      wc [OPTION]... [FILE]...
  745.    `wc' prints one line of counts for each file, and if the file was
  746. given as an argument, it prints the file name following the counts.  If
  747. more than one FILE is given, `wc' prints a final line containing the
  748. cumulative counts, with the file name `total'.  The counts are printed
  749. in this order: newlines, words, bytes.
  750.    By default, `wc' prints all three counts.  Options can specify that
  751. only certain counts be printed.  Options do not undo others previously
  752. given, so
  753.      wc --bytes --words
  754. prints both the byte counts and the word counts.
  755.    The program accepts the following options.  Also see *Note Common
  756. options::.
  757. `--bytes'
  758. `--chars'
  759.      Print only the byte counts.
  760. `--words'
  761.      Print only the word counts.
  762. `--lines'
  763.      Print only the newline counts.
  764. File: textutils.info,  Node: sum invocation,  Next: cksum invocation,  Prev: wc invocation,  Up: Summarizing files
  765. `sum': Print checksum and block counts
  766. ======================================
  767.    `sum' computes a 16-bit checksum for each given FILE, or standard
  768. input if none are given or for a FILE of `-'.  Synopsis:
  769.      sum [OPTION]... [FILE]...
  770.    `sum' prints the checksum for each FILE followed by the number of
  771. blocks in the file (rounded up).  If more than one FILE is given, file
  772. names are also printed (by default).  (With the `--sysv' option,
  773. corresponding file name are printed when there is at least one file
  774. argument.)
  775.    By default, GNU `sum' computes checksums using an algorithm
  776. compatible with BSD `sum' and prints file sizes in units of 1024-byte
  777. blocks.
  778.    The program accepts the following options.  Also see *Note Common
  779. options::.
  780.      Use the default (BSD compatible) algorithm.  This option is
  781.      included for compatibility with the System V `sum'.  Unless `-s'
  782.      was also given, it has no effect.
  783. `--sysv'
  784.      Compute checksums using an algorithm compatible with System V
  785.      `sum''s default, and print file sizes in units of 512-byte blocks.
  786.    `sum' is provided for compatibility; the `cksum' program (see next
  787. section) is preferable in new applications.
  788. File: textutils.info,  Node: cksum invocation,  Next: md5sum invocation,  Prev: sum invocation,  Up: Summarizing files
  789. `cksum': Print CRC checksum and byte counts
  790. ===========================================
  791.    `cksum' computes a cyclic redundancy check (CRC) checksum for each
  792. given FILE, or standard input if none are given or for a FILE of `-'.
  793. Synopsis:
  794.      cksum [OPTION]... [FILE]...
  795.    `cksum' prints the CRC checksum for each file along with the number
  796. of bytes in the file, and the filename unless no arguments were given.
  797.    `cksum' is typically used to ensure that files transferred by
  798. unreliable means (e.g., netnews) have not been corrupted, by comparing
  799. the `cksum' output for the received files with the `cksum' output for
  800. the original files (typically given in the distribution).
  801.    The CRC algorithm is specified by the POSIX.2 standard.  It is not
  802. compatible with the BSD or System V `sum' algorithms (see the previous
  803. section); it is more robust.
  804.    The only options are `--help' and `--version'.  *Note Common
  805. options::.
  806. File: textutils.info,  Node: md5sum invocation,  Prev: cksum invocation,  Up: Summarizing files
  807. `md5sum': Print or check message-digests
  808. ========================================
  809.    `md5sum' computes a 128-bit checksum (or "fingerprint" or
  810. "message-digest") for each specified FILE.  If a FILE is specified as
  811. `-' or if no files are given `md5sum' computes the checksum for the
  812. standard input.  `md5sum' can also determine whether a file and
  813. checksum are consistent. Synopsis:
  814.      md5sum [OPTION]... [FILE]...
  815.      md5sum [OPTION]... --check [FILE]
  816.      md5sum [OPTION]... --string=STRING ...
  817.    For each FILE, `md5sum' outputs the MD5 checksum, a flag indicating
  818. a binary or text input file, and the filename.  If FILE is omitted or
  819. specified as `-', standard input is read.
  820.    The program accepts the following options.  Also see *Note Common
  821. options::.
  822. `--binary'
  823.      Treat all input files as binary.  This option has no effect on Unix
  824.      systems, since they don't distinguish between binary and text
  825.      files.  This option is useful on systems that have different
  826.      internal and external character representations.
  827. `--check'
  828.      Read filenames and checksum information from the single FILE (or
  829.      from stdin if no FILE was specified) and report whether each named
  830.      file and the corresponding checksum data are consistent.  The
  831.      input to this mode of `md5sum' is usually the output of a prior,
  832.      checksum-generating run of `md5sum'.  Each valid line of input
  833.      consists of an MD5 checksum, a binary/text flag, and then a
  834.      filename.  Binary files are marked with `*', text with ` '.  For
  835.      each such line, `md5sum' reads the named file and computes its MD5
  836.      checksum.  Then, if the computed message digest does not match the
  837.      one on the line with the filename, the file is noted as having
  838.      failed the test.  Otherwise, the file passes the test.  By
  839.      default, for each valid line, one line is written to standard
  840.      output indicating whether the named file passed the test.  After
  841.      all checks have been performed, if there were any failures, a
  842.      warning is issued to standard error.  Use the `--status' option to
  843.      inhibit that output.  If any listed file cannot be opened or read,
  844.      if any valid line has an MD5 checksum inconsistent with the
  845.      associated file, or if no valid line is found, `md5sum' exits with
  846.      nonzero status.  Otherwise, it exits successfully.
  847. `--status'
  848.      This option is useful only when verifying checksums.  When
  849.      verifying checksums, don't generate the default one-line-per-file
  850.      diagnostic and don't output the warning summarizing any failures.
  851.      Failures to open or read a file still evoke individual diagnostics
  852.      to standard error.  If all listed files are readable and are
  853.      consistent with the associated MD5 checksums, exit successfully.
  854.      Otherwise exit with a status code indicating there was a failure.
  855. `--string=STRING'
  856.      Compute the message digest for STRING, instead of for a file.  The
  857.      result is the same as for a file that contains exactly STRING.
  858. `--text'
  859.      Treat all input files as text files.  This is the reverse of
  860.      `--binary'.
  861. `--warn'
  862.      When verifying checksums, warn about improperly formated MD5
  863.      checksum lines.  This option is useful only if all but a few lines
  864.      in the checked input are valid.
  865. File: textutils.info,  Node: Operating on sorted files,  Next: Operating on fields within a line,  Prev: Summarizing files,  Up: Top
  866. Operating on sorted files
  867. *************************
  868.    These commands work with (or produce) sorted files.
  869. * Menu:
  870. * sort invocation::             Sort text files.
  871. * uniq invocation::             Uniqify files.
  872. * comm invocation::             Compare two sorted files line by line.
  873.