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