shell command --join

shell command --join

0, join the exclusive command map bed

Click here to quickly open the article [ map bed _shell command join ]

1, the function join command Description

joinCommand for the two files, the same line specifies the contents of the field are connected. Find two files, specify the contents of the field the same line and be merged, and then output to the standard output device.

2, join command syntax

SYNOPSIS
       join [OPTION]... FILE1 FILE2

3, join command options Description

  • -a <1 or 2>: In addition to displaying the contents of the original output but also the file does not show the same command line field.
  • -e <string>: If [Document 1] and [Document 2] was not found in the appropriate field, option character string is filled in the output.
  • -i or --igore-case: comparing the contents of the field, ignoring case differences.
  • -o <format>: according to the specified format to display the results.
  • -t <character>: Use the field separator character.
  • -v <1 or 2>: with -a same, but the file does not only show the same field line.
  • -1 <field>: connection [Document 1] specified field.
  • -2 <field>: connection [Document 2] in a designated field.
  • --help: Displays help.
  • --version: show the version information.

4, hands-join command

Example 1: Joins the two files

Preparing the Environment

cat >file1.txt <<'EOF'
Hello 1
Linux 11
Test 111
EOF

cat >file2.txt <<'EOF'
Hello 2
Linux 22
Test 222
EOF

cat file1.txt
cat file2.txt

Connection file

Position of the file 1 and the file 2 of the result output to the standard output is influential

join file1.txt file2.txt  -->连接方式1
join file2.txt file1.txt  -->连接方式2

"MineGi something to say": Come and sweep the two-dimensional code link below, and join us!

Guess you like

Origin www.cnblogs.com/MineGi/p/12221470.html