Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fold(1) — CLIX 3.1r7.6.22

Media Vault

Software Library

Restoration Projects

Artifacts Sought



  fold(1)                             CLIX                             fold(1)



  NAME

    fold - Folds lines from input files

  SYNOPSIS

    fold [-bs] [-w width] [file...]

  FLAGS

    -b         Counts the width in bytes rather than column positions.  The
               input files specified with this flag are text files, except
               that the lines are not limited to LINE_MAX bytes in length.

    -s         Breaks the line into segments.  If a segment of a line contains
               a blank space within the first width column positions or bytes,
               the line is broken after the last blank space meeting the width
               constraints.  If no blank space meets the width requirements,
               the -s flag has no effect for that output segment of the input
               line.

    -w width   Specifies the maximum line length, in column positions (or
               bytes, if the -b flag is used).  The results are unspecified if
               the width is not a positive decimal number.  The default value
               is 80.

  DESCRIPTION

    The fold command folds lines from input files, breaking the lines to have
    a maximum of width column positions or bytes (if the -b flag is used).
    Lines are broken by the insertion of a <newline> character such that each
    output line (called a segment) is the maximum width possible that does not
    exceed the specified number of column positions or bytes.

    If no input file is specified, the standard input is used.  The input
    files specified with the -b flag are text files, except that the lines are
    not limited to LINE_MAX bytes in length.  If the -b flag is not used, the
    input files are text files.

    The standard output is a file containing a sequence of characters whose
    order is preserved from the input file(s), possibly with some inserted
    <newline> characters.

    If the <Return> , <Backspace> , or <Tab> characters are encountered in the
    input, and the -b flag is not specified, they are specially treated as
    explained in the following list:

    <Return>      The current count of the line width is set to zero.  The
                  fold utility does not insert a <newline> character
                  immediately before or after any <Return> character.




  2/94 - Intergraph Corporation                                              1






  fold(1)                             CLIX                             fold(1)



    <Backspace>   The current count of the line width is decremented by one.
                  The count will never become negative.  The fold utility does
                  not insert a <newline> character immediately before or after
                  any <Backspace> character.

    <Tab>         Each <Tab> character advances the column position pointer to
                  the next tab stop. Tab stops are at each column position n
                  such that n modulo 8 equals 1.

  Environment Variables

    The following environment variables affect the execution of the fold
    command:

    LANG          Determines the locale to use for the locale categories when
                  both LC_ALL and the corresponding environment variable
                  (beginning with LC_) do not specify a locale.

    LC_ALL        Determines the locale to be used to override any values for
                  the locale categories specified by the settings of LANG or
                  any environment variables beginning with LC_.

    LC_CTYPE      Determines the locale for the interpretation of sequences of
                  bytes of text data as characters (for example, single-byte
                  versus multibyte characters in arguments and input files)
                  and for the determination of the width in column positions
                  each character would occupy on a constant width font output
                  device.

    LC_MESSAGES   Determines the language in which messages are written.

  EXAMPLES

    This example submits the file bigfile with 132-character lines to the
    printer.

    fold -w 132 bigfile | lp


  NOTES

    A line wil not be broken in the middle of a character.

    The behavior is undefined if width is less than the number of columns that
    any single character of the input occupies.

  EXIT VALUES

    The fold command returns a value of 0 if successful.  If unsuccessful, it
    returns a positive nonzero value.




  2                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026