⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fold.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>fold</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_757">&nbsp;</a>NAME</h4><blockquote>fold - filter for folding lines</blockquote><h4><a name = "tag_001_014_758">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>fold <b>[</b>-bs<b>][</b>-w <i>width</i><b>][</b><i>file</i>...<b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_759">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>fold</i>utility is a filter that will fold lines from its input files,breaking the lines to have a maximum of<i>width</i>column positions (or bytes, if the<b>-b</b>option is specified).Lines will be broken by the insertion of anewlinecharacter such that each output line (referred to later inthis section as a segment) is the maximum width possible that does notexceed the specified number of column positions (or bytes).A line will not be broken in the middle of a character.The behaviour is undefined if<i>width</i>is less than the number of columns any single character in theinput would occupy.<p>If thecarriage-return,backspaceortabcharacters are encountered in the input, and the<b>-b</b>option is not specified, they will be treated specially:<dl compact><dt>backspace<dd>The current count of line width will be decremented byone, although the count never will become negative.The<i>fold</i>utility will not insert anewline characterimmediately before or after anybackspace character.<dt>carriage-return<dd>The current count of line width will be set to zero.The<i>fold</i>utility will not insert anewline characterimmediately before or after anycarriage-return character.<dt>tab<dd>Eachtabcharacter encountered will advance the column position pointerto the next tab stop.Tab stops will be at each column position<i>n</i>such that<i>n</i>modulo 8 equals 1.</dl></blockquote><h4><a name = "tag_001_014_760">&nbsp;</a>OPTIONS</h4><blockquote>The<i>fold</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .<p>The following options are supported:<dl compact><dt><b>-b</b><dd>Count<i>width</i>in bytes rather than column positions.<dt><b>-s</b><dd>If a segment of a line contains ablank characterwithin the first<i>width</i>column positions (or bytes), break the line after the last suchblank charactermeeting the width constraints.If there is noblank charactermeeting the requirements, the<b>-s</b>option will have no effect for that output segment of the input line.<dt><b>-w&nbsp;</b><i>width</i><dd>Specify the maximum line length, in column positions(or bytes if<b>-b</b>is specified).The results are unspecified if<i>width</i>is not a positive decimal number.The default value is 80.</dl></blockquote><h4><a name = "tag_001_014_761">&nbsp;</a>OPERANDS</h4><blockquote>The following operand is supported:<dl compact><dt><i>file</i><dd>A pathname of a text file to be folded.If no<i>file</i>operands are specified,the standard input will be used.</dl></blockquote><h4><a name = "tag_001_014_762">&nbsp;</a>STDIN</h4><blockquote>The standard input will be used only if no<i>file</i>operands are specified.See the INPUT FILES section.</blockquote><h4><a name = "tag_001_014_763">&nbsp;</a>INPUT FILES</h4><blockquote>If the<b>-b</b>option is specified, the input files must be textfiles except that the lines are not limited to{LINE_MAX}bytes in length.If the<b>-b</b>option is not specified, the input files must be text files.</blockquote><h4><a name = "tag_001_014_764">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>fold</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments and input files),and for the determination of the width in column positionseach character would occupy on a constant-width font output device.<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_765">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_766">&nbsp;</a>STDOUT</h4><blockquote>The standard output will be a filecontaining a sequence of characters whoseorder will be preserved from the input files, possibly with insertednewlinecharacters.</blockquote><h4><a name = "tag_001_014_767">&nbsp;</a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_768">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_769">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_770">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>All input files were processed successfully.<dt>&gt;0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_771">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_772">&nbsp;</a>APPLICATION USAGE</h4><blockquote>The<i><a href="cut.html">cut</a></i>and<i>fold</i>utilities can be used to create text files out of fileswith arbitrary line lengths.The<i><a href="cut.html">cut</a></i>utility should be used when thenumber of lines (or records) needs to remain constant.The<i>fold</i>utility should be used when the contents oflong lines need to be kept contiguous.<p>The<i>fold</i>utility is frequently used to send text files to printersthat truncate, rather than fold,lines wider than the printer is able to print(usually 80 or 132 column positions).<br></blockquote><h4><a name = "tag_001_014_773">&nbsp;</a>EXAMPLES</h4><blockquote>An example invocation that submits a file of possibly long lines to theprinter (under the assumption that the user knows the line width ofthe printer to be assigned by<i><a href="lp.html">lp</a></i>):<pre><code>fold -w 132 bigfile | lp</code></pre></blockquote><h4><a name = "tag_001_014_774">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_775">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="cut.html">cut</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -