Paste

来自WordPress中文文档
跳转至: 导航搜索

Linux命令:paste

功能说明:合并文件的列。


语  法:paste [-s][-d <间隔字符>][--help][--version][文件...]
补充说明:paste指令会把每个文件以列对列的方式,一列列地加以合并。
参  数:
-d<间隔字符>或--delimiters=<间隔字符>  用指定的间隔字符取代跳格字符。 
-s或--serial  串列进行而非平行处理。 
--help  在线帮助。 
--version  显示帮助信息。


英文版本,欢迎翻译:

ABOUT PASTE

Merge corresponding or subsequent lines of files.

SYNTAX

paste [-s] [-d list] file

-s Concatenate all of the lines of each separate input file in command line order. The NEWLINE character of every line except the last line in each input file will be replaced with the TAB character, unless otherwise specified by the -d option. -d list Unless a backslash character () appears in list, each character in list is an element specifying a delimiter character. If a backslash character appears in list, the backslash character and one or more characters following it are an element specifying a delimiter character as described below. These elements specify one or more delimiters to use, instead of the default TAB character, to replace the NEWLINE character of the input lines. The elements in list are used circularly; that is, when the list is exhausted the first element from the list is reused. When the -s option is specified:

The last newline character in a file will not be modified. The delimiter will be reset to the first element of list after each file operand is processed. When the option is not specified:

The NEWLINE characters in the file specified by the last file will not be modified. The delimiter will be reset to the first element of list each time a line is processed from each file. If a backslash character appears in list, it and the character following it will be used to represent the following delimiter characters:

n Newline character. t Tab character. \ Backslash character.

Empty string (not a null character). If is immediately followed by the character x, the character X, or any character defined by the LC_CTYPE digit keyword, the results are unspecified. 

If any other characters follow the backslash, the results are unspecified.

file A path name of an input file. If - is specified for one or more of the file s, the standard input will be used; the standard input will be read one line at a time, circularly, for each instance of -. Implementations support pasting of at least 12 file operands.


EXAMPLES

The below example would take the input from ls and paste that input into four columns.

ls | paste - - - -