uspTukubaiコマンドに関する様々な資料がここにあります。

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

hcat(USP)

Name

hcat : Concatenates files horizontally

Synopsis

Usage   : hcat [-<n>] [-T<tmpdir>] file1 file2 ...

Version : Wed Sep 19 13:56:03 JST 2018

Edition : 2

Description

Horizontally concatenates the multiple files passed as

arguments. The file format is not changed and the resulting

file looks as if the files have been lined up horizontally.

If you specify the -T<tmpdir> option, the command will create

the temporary file into diretory <tmpdir> when the temporary file

is needed. The default directory is /tmp.  The temporary file is

needed when the input is not a regular file.

Example 1

Basic Usage

$ cat file1

0000000 Smith______ 50 F

0000001 Jones______ 50 F

0000003 Wilson_____ 26 F

0000004 Drake______ 40 M

0000005 Hawking____ 50 F

0000007 Newton_____ 42 F

$ cat file2

0000000 91 59 20 76 54

0000001 46 39 8  5 21

0000003 30 50 71 36 30

0000004 58 71 20 10 6

0000005 82 79 16 21 80

0000007 50 2  33 15 62

$ hcat file1 file2 > file3

$ cat file3

0000000 Smith______ 50 F 0000000 91 59 20 76 54

0000001 Jones______ 50 F 0000001 46 39 8  5 21

0000003 Wilson_____ 26 F 0000003 30 50 71 36 30

0000004 Drake______ 40 M 0000004 58 71 20 10 6

0000005 Hawking____ 50 F 0000005 82 79 16 21 80

0000007 Newton_____ 42 F 0000007 50 2  33 15 62

Example 2

Specify the "-<n>" option to open up <n> number of spaces between

the concatenated files.

$ hcat -3 file1 file2 > file3

$ cat file3

0000000 Smith______ 50 F   0000000 91 59 20 76 54

0000001 Jones______ 50 F   0000001 46 39 8  5 21

0000003 Wilson_____ 26 F   0000003 30 50 71 36 30

0000004 Drake______ 40 M   0000004 58 71 20 10 6

0000005 Hawking____ 50 F   0000005 82 79 16 21 80

0000007 Newton_____ 42 F   0000007 50 2  33 15 62

                      ↑ 3 spaces

Example 3

If -0 is specified, then no space is left between the

files.

hcat -0 file1 file2 > file3

$ cat file3

0000000 Smith______ 50 F0000000 91 59 20 76 54

0000001 Jones______ 50 F0000001 46 39 8  5 21

0000003 Wilson_____ 26 F0000003 30 50 71 36 30

0000004 Drake______ 40 M0000004 58 71 20 10 6

0000005 Hawking____ 50 F0000005 82 79 16 21 80

0000007 Newton_____ 42 F0000007 50 2  33 15 62

Example 4

To read one of the files from standard input, specify

the file name as "-".

$ cat file1 | hcat - file2 > file3

$ cat file2 | hcat file1 - > file3

Note

In order to keep the formatting on all of the files,

hcat first calculates the widest line in each file.

If you want to simply horizontally merge several files

line-by-line leaving one space between lines, using

the paste command is faster.

$ paste -d" " file1 file2 file3