FOLD man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

FOLD(1)								       FOLD(1)

       fold - filter for folding lines

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

       The fold utility is a filter that will fold lines from its input files,
       breaking the lines to have a maximum  of	 width	column	positions  (or
       bytes,  if  the	-b  option  is specified). Lines will be broken by the
       insertion of a NEWLINE character such that each output  line  (referred
       to  later  in  this section as a segment) is the maximum width possible
       that does not exceed the	 specified  number  of	column	positions  (or
       bytes).	A  line	 will  not be broken in the middle of a character. The
       behavior is undefined if width is less than the number of  columns  any
       single character in the input would occupy.

       If the CARRIAGE-RETURN, BACKSPACE, or TAB characters are encountered in
       the input, and the -b option is not specified,  they  will  be  treated

			   The current count of line width will be decremented
			   by one, although the count never will become	 nega‐
			   tive.  fold	will  not  insert  a NEWLINE character
			   immediately before or after any  BACKSPACE  charac‐

			   The	current	 count of line width will be set to 0.
			   fold will not insert a  NEWLINE  character  immedi‐
			   ately  before  or after any CARRIAGE-RETURN charac‐

			   Each TAB character  encountered  will  advance  the
			   column  position  pointer to the next tab stop. Tab
			   stops will be at each column position n such that n
			   modulo 8 equals 1.

       The following options are supported:

			   Counts width in bytes rather than column positions.

			   If  a  segment of a line contains a blank character
			   within the first width column positions (or bytes),
			   breaks the line after the last such blank character
			   meeting the width constraints. If there is no blank
			   character  meeting  the requirements, the -s option
			   will have no effect for that output segment of  the
			   input line.

       -w width|-width
			   Specifies  the maximum line length, in column posi‐
			   tions (or bytes if -b is specified).	 If  width  is
			   not	 a   positive  decimal	number,	 an  error  is
			   returned. The default value is 80.

       The following operand is supported:

		A path name of a text file to be folded. If no	file  operands
		are specified, the standard input will be used.

       Example 1 Submitting a file of possibly long lines to the line printer

       An example invocation that submits a file of possibly long lines to the
       line printer (under the assumption that the user knows the  line	 width
       of the printer to be assigned by lp(1)):

	 example% fold -w 132 bigfile | lp

       See  environ(5) for descriptions of the following environment variables
       that affect the execution of fold: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
       and NLSPATH.

       The following exit values are returned:

	      All input files were processed successfully.

	      An error occurred.

       See attributes(5) for descriptions of the following attributes:

       │CSI		    │ enabled	      │
       │Interface Stability │ Standard	      │

       cut(1), pr(1), attributes(5), environ(5), standards(5)

       fold  and  cut(1)  can  be  used to create text files out of files with
       arbitrary line lengths. fold should be used when the contents  of  long
       lines need to be kept contiguous. cut should be used when the number of
       lines (or records) needs to remain constant.

       fold is frequently used to send text files to line printers that	 trun‐
       cate,  rather  than fold, lines wider than the printer is able to print
       (usually 80 or 132 column positions).

       fold may not work correctly if underlining is present.

				  Feb 1, 1995			       FOLD(1)

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net