'\" te .\" Copyright 1989 AT&T Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation.Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation.In the following statement, the phrase "this text" refers to portions of the system documentation.Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document.The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.This notice shall appear on any product containing this material. .TH col 1 "1995 年 2 月 1 日" "SunOS 5.11" "用户命令" .SH 名称 col \- 过滤反向换行符 .SH 用法概要 .LP .nf \fBcol\fR [\fB-bfpx\fR] .fi .SH 描述 .sp .LP \fBcol\fR 实用程序从标准输入读取并写入标准输出。它可执行反向换行符以及半正向换行符和半反向换行符暗含的行覆盖。除非使用 \fB-x\fR,否则只要有可能,便会将输入中的所有空白字符转换为制表符。\fBcol\fR 对于过滤使用 \fBnroff\fR(1) 的 \fB\&.rt\fR 命令生成的多列输出和使用 \fBtbl\fR(1) 预处理程序生成的输出特别有用。 .sp .LP \fBcol\fR 使用 \fBASCII\fR 控制字符 \fBSO\fR 和 \fBSI\fR 表示备用字符集中文本的开始和结束位置。程序将记住每个输入字符所属的字符集,输出时视情况生成 \fBSI\fR 和 \fBSO\fR 字符,以确保将每个字符写入正确的字符集。 .sp .LP 输入时,只接受以下控制字符:空格、退格、制表符、回车和换行符、\fBSI\fR、\fBSO\fR、\fBVT\fR、反向换行符、半正向换行符和半反向换行符。\fBVT\fR 字符是全反向换行符的备用格式,包含它是为了与该类型的一些早期程序兼容。要复制到输出中的其他字符必须是可列显字符。 .sp .LP 上述控制函数和行移动序列的 \fBASCII\fR 代码如下表中所示。\fBESC\fR 表示 \fBASCII\fR 转义符,八进制代码为 033;\fBESC\fR\fB-\fR 表示两个字符的序列,\fBESC\fR 后跟字符 \fBx\fR。 .sp .sp .TS tab(); lw(2.75i) lw(2.75i) lw(2.75i) lw(2.75i) . 反向换行符ESC-7 半反向换行符ESC-8 半正向换行符ESC-9 垂直制表符 (VT)013 文本开始 (SO)016 文本结束 (SI)017 .TE .SH 选项 .sp .ne 2 .mk .na \fB\fB-b\fR\fR .ad .RS 6n .rt 假设使用的输出设备无法退格。在这种情况下,如果两个或更多字符出现在同一位置,将只输出最后读取的一个。 .RE .sp .ne 2 .mk .na \fB\fB-f\fR\fR .ad .RS 6n .rt 尽管 \fBcol\fR 在输入中接受半行移动,但是通常在输出时并不将其省略。而是将出现在行之间的文本移至下一个整行边界。这种处理方式可通过 \fB-f\fR (fine) 选项加以阻止;在这种情况下,\fBcol\fR 的输出中可能包含半正向换行符 (ESC-9),但是仍然从不包含任何类型的反向换行移动。 .RE .sp .ne 2 .mk .na \fB\fB-p\fR\fR .ad .RS 6n .rt 通常,\fBcol\fR 将忽略输入中发现的任何未知转义序列;如果使用 \fB-p\fR 选项,\fBcol\fR 会将这些序列作为常规字符输出,但要受反向换行移动产生的套印的限制。强烈建议不要使用该选项,除非用户完全了解转义序列的文本位置。 .RE .sp .ne 2 .mk .na \fB\fB-x\fR\fR .ad .RS 6n .rt 尽可能阻止 \fBcol\fR 在输出时将空白字符转换为制表符。将制表停止位置视为每个列的 \fIn\fR 位置,以使 \fIn\fR 按模为 8 计算等于 1。 .RE .SH 环境变量 .sp .LP 有关影响 \fBcol\fR 执行的环境变量 \fBLC_CTYPE\fR、\fBLC_MESSAGES\fR 和 \fBNLSPATH\fR 的说明,请参见 \fBenviron\fR(5)。 .SH 退出状态 .sp .LP 将返回以下错误值: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 7n .rt 成功完成。 .RE .sp .ne 2 .mk .na \fB\fB>0\fR \fR .ad .RS 7n .rt 出现错误。 .RE .SH 属性 .sp .LP 有关下列属性的说明,请参见 \fBattributes\fR(5): .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性类型属性值 _ 可用性system/core-os CSIenabled(已启用) .TE .SH 另请参见 .sp .LP \fBnroff\fR(1)、\fBtbl\fR(1)、\fBascii\fR(5)、\fBattributes\fR(5)、\fBenviron\fR(5) .SH 附注 .sp .LP \fBcol\fR 接受的输入格式与使用 \fB-T37\fR 或 \fB-Tlp\fR 选项时 \fBnroff\fR 生成的输出匹配。如果最终处理 \fBcol\fR 输出的设备可以解释半行移动,应使用 \fB-T37\fR(与 \fBcol\fR 的 \fB-f\fR 选项)。否则,应使用 \fB-Tlp\fR。 .sp .LP \fBcol\fR 无法备份超过 128 行或每行处理超过 800 个字符。 .sp .LP 将忽略会导致备份超过文档第一行的局部垂直移动。因此,第一行不得带有任何上标。