col (过滤来自输入的反向换行)

rose1 发表于 2020-08-24 10:29
浏览次数:
在手机上阅读

在类似Unix的操作系统上,col命令过滤来自输入的反向换行。 本文档介绍了col的GNU / Linux版本。

查看英文版

目录

1 col 运行系统环境

2 col 说明

3 col 语法

col 运行系统环境

Linux

col 说明

col 实用程序筛选出反向(和半反向)换行,以便输出以正确的顺序,仅具有正向和半正向换点,并在可能的情况下将空白字符替换为选项卡。这在处理nrofftbl 的输出时非常有用。

col实用程序从标准输入读取,写入标准输出。

The col utility filters out reverse (and half reverse) line feeds so that the output is in the correct order with only forward and half forward line feeds, and replaces whitespace characters with tabs where possible. This can be useful in processing the output of nroff and tbl.

The col utility reads from the standard input and writes to the standard output.

查看英文版

查看中文版

col 语法

col [-bfhpx] [-l num]

选项

-b

不要输出任何回格,只打印写入每个列位置的最后一个字符。

-f

允许向前半线馈送("精细"模式)。通常,在半行边界上打印的字符打印在以下行上。

-h

不要输出多个空格而不是选项卡(这是默认值)。

-l num

缓冲区内存中至少数行。默认情况下,128 行进行缓冲。

-p

强制通过未更改的未知控制序列。通常,col会从输入中筛选出除其自身识别和解释的输入以外的任何控制序列(下面列出)。

-x

输出多个空格而不是选项卡。

识别的控制序列 

col 理解的滑车运动的控制序列及其十进制值列在下表中:

Esc-7

反向换行(先转义 7)

Esc-8

反向换行一半(然后转8)

Esc-9

前馈一半(转义9)

backspace

向后移一列(8);在第一栏中忽略

carriage return

(13)

newline

前馈(10); 也回车

shift in

转换为普通字符集(15)

shift out

切换到备用字符集(14)

space

向前移动一列(32)

tab

移至下一个制表位(9)

vertical tab

反向换行(11)

丢弃所有无法识别的控制字符和转义序列。

col实用程序在读取字符时跟踪字符集,并确保字符集在输出时正确。

如果输入尝试备份到最后一个刷新的行,col将显示一条警告消息。

col [-bfhpx] [-l num]

Options

-b

Do not output any backspaces, printing only the last character written to each column position.

-f

Forward half line feeds are permitted ("fine" mode). Normally characters printed on a half line boundary are printed on the following line.

-h

Do not output multiple spaces instead of tabs (This is the default).

-l num

Buffer at least num lines in memory. By default, 128 lines are buffered.

-p

Force unknown control sequences to be passed through unchanged. Normally, col will filter out any control sequences from the input other than those recognized and interpreted by itself (which are listed below).

-x

Output multiple spaces instead of tabs.

Recognized Control Sequences

The control sequences for carriage motion that col understands and their decimal values are listed in the following table:

Esc-7

reverse line feed (escape then 7)

Esc-8

half reverse line feed (escape then 8)

Esc-9

half forward line feed (escape then 9)

backspace

moves back one column (8); ignored in the first column

carriage return

(13)

newline

forward line feed (10); also does carriage return

shift in

shift to normal character set (15)

shift out

shift to alternate character set (14)

space

moves forward one column (32)

tab

moves forward to next tab stop (9)

vertical tab

reverse line feed (11)

All unrecognized control characters and escape sequences are discarded.

The col utility keeps track of the character set as characters are read and makes sure the character set is correct when they are output.

If the input attempts to back up to the last flushed line, col displays a warning message.

查看英文版

查看中文版

其他命令行

cut | cu | csplit | crontab | cpio | continue | compress | cmp | cksum | chsh | chroot | chkey | cd | chmod | cp | comm | chown | cal | calendar | clear | chfn | cancel | cat | cc | cfdisk | checkeq | checknr | chgrp |

如此好文,分享给朋友
发表评论
验证码:
评论列表
共0条