'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1996, 2011, Oracle and/or its affiliates.All rights reserved. .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" 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 paste 1 "2011 年 11 月 28 日" "SunOS 5.11" "用户命令" .SH 名称 paste \- 合并文件中的对应行或后续行 .SH 用法概要 .LP .nf \fB/usr/bin/paste\fR [\fIoptions\fR] [\fIfile\fR...] .fi .SH 描述 .sp .LP paste 实用程序会串联给定输入文件的对应行,并将生成的行写入标准输出。 .sp .LP paste 的缺省操作是串联输入文件的对应行。除了最后一个输入文件的行以外,每行的换行符都替换为制表符。 .sp .LP 如果在一个或多个(但不是所有)输入文件上检测到 EOF(文件结尾)条件,paste 会按照从检测到 EOF 的文件读取空行的方式执行操作,除非指定了 \fB-s\fR 选项。 .SH 选项 .sp .LP 支持以下选项: .sp .ne 2 .mk .na \fB\fB-d\fR \fIlist\fR\fR .ad .RS 11n .rt 除非反斜杠字符 (\fB\\fR) 出现在列表中,否则列表中的每个字符都是指定分隔符的元素。如果反斜杠字符出现在列表中,反斜杠字符及其后面的一个或多个字符都是指定分隔符的元素,具体如下文所示。这些元素会指定要使用的一个或多个分隔符,而非缺省的制表符,用于替换输入行的换行符。列表中的元素会循环使用。也就是说,列表中的元素用遍后,则会重新使用列表中的第一个元素。 .sp 指定 \fB-s\fR 选项时: .RS +4 .TP .ie t \(bu .el o 不修改文件中的最后一个换行符。 .RE .RS +4 .TP .ie t \(bu .el o 每个文件操作数都处理完毕后,将分隔符重置为列表中的第一个元素。 .RE 未指定此选项时: .RS +4 .TP .ie t \(bu .el o 不修改最后一个文件指定的文件中的换行符。 .RE .RS +4 .TP .ie t \(bu .el o 每个文件的行都处理完毕后,将分隔符重置为列表中的第一个元素。 .RE 如果反斜杠字符出现在列表中,使用反斜杠字符及其后面的字符表示以下分隔符: .sp .ne 2 .mk .na \fB\fB\n\fR\fR .ad .RS 6n .rt 换行符。 .RE .sp .ne 2 .mk .na \fB\fB\t\fR\fR .ad .RS 6n .rt TAB 字符。 .RE .sp .ne 2 .mk .na \fB\fB\\\fR\fR .ad .RS 6n .rt 反斜杠字符。 .RE .sp .ne 2 .mk .na \fB\fB\0\fR\fR .ad .RS 6n .rt 空字符串(不是 null 字符)。如果 \fB0\fR 后面紧跟字符 \fBx\fR、字符 \fBX\fR 或 \fBLC_CTYPE\fR 数字关键字定义的任何字符,则结果不确定。 .RE 如果反斜杠后面跟有任何其他字符,则结果不确定。 .RE .sp .ne 2 .mk .na \fB\fB-s\fR\fR .ad .RS 11n .rt 按命令行顺序串联各输入文件的所有行。每个输入文件的每一行(最后一行除外)的换行符都替换为制表符,除非 \fB-d\fR 选项另有指定。 .RE .SH 操作数 .sp .LP 支持下列操作数: .sp .ne 2 .mk .na \fB\fIfile\fR\fR .ad .RS 8n .rt 输入文件的路径名称。如果为一个或多个文件指定,则使用标准输入。为点 (\fB\&.\fR) 的每个实例循环读取标准输入,一次一行。实现支持跳过至少 12 个文件操作数。 .RE .SH 用法 .sp .LP 有关 \fBpaste\fR 遇到大于或等于 2 GB(2^31 字节)文件时行为的说明,请参见 \fBlargefile\fR(5)。 .SH 示例 .LP \fB示例 1 \fR在一列中列出目录 .sp .LP 以下是在一列中列出目录的示例: .sp .in +2 .nf example% \fBls | paste -d" " \(mi\fR .fi .in -2 .sp .LP \fB示例 2 \fR在四列中列出目录 .sp .LP 以下是在四列中列出目录的示例: .sp .in +2 .nf example% \fBls | paste \(mi \(mi \(mi \(mi\fR .fi .in -2 .sp .LP \fB示例 3 \fR将一个文件的多个行对合并为多个单行 .sp .LP 以下是将文件的多个行对合并为多个单行的示例: .sp .in +2 .nf example% \fBpaste -s -d"\e t\e n" file\fR .fi .in -2 .sp .SH 环境变量 .sp .LP 有关影响 \fBpaste\fR 执行的以下环境变量的说明,请参见 \fBenviron\fR(5):\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR 和 \fBNLSPATH\fR。 .SH 退出状态 .sp .LP 将返回以下退出值: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt 成功完成。 .RE .sp .ne 2 .mk .na \fB\fB>0\fR\fR .ad .RS 6n .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(已启用) _ 接口稳定性Committed(已确定) _ 标准请参见 \fBstandards\fR(5)。 .TE .SH 另请参见 .sp .LP \fBcut\fR(1)、\fBgrep\fR(1)、\fBattributes\fR(5)、\fBenviron\fR(5)、\fBlargefile\fR(5)、\fBstandards\fR(5)