• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

join Command Examples in Linux

by admin

join command joins lines of two files on a common field.

Syntax:

# join [OPTION]... FILE1 FILE2

For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by whitespace. When FILE1 or FILE2 (not both) is -, read standard input.

join Command Examples

1. To join and show the common lines from given input files:

# join file1.txt file2.txt 

2. To print the unpairable lines from specified file:

# join -a 1
# join -a 2 

3. To replace the missing fields with empty:

# join -e EMPTY 

4. To ignore the case difference when comparing:

# join -i file1.txt file2.txt
# join --ignore-case file1.txt file2.txt 

5. To obey format while constructing output:

# join -o FORMAT file1.txt file2.txt 

6. To use the CHAR as input and output field separator:

# join -r CHAR file1.txt file2.txt 

7. To print unpairable and suppress joined:

# join -v 1 file1.txt file2.txt 

8. To check the input is sorted:

# join --check-order file1.txt file2.txt 

9. To not to check the input is sorted:

# join --nocheck-order file1.txt file2.txt 

10. To display the help and exit:

# join --help

11. To get the version info:

# join --version 

Filed Under: Linux

Some more articles you might also be interested in …

  1. mailstat Command Examples in Linux
  2. Linux OS Service ‘nscd’
  3. CentOS / RHEL : Converting an Existing Root Filesystem to LVM Partition
  4. resize2fs Command Examples in Linux
  5. Filesystems Are Not Getting Mounted in Order on CentOS/RHEL 7
  6. How to Find the Original Installation OS Version in CentOS/RHEL
  7. How To Add New Disk to An Existing Diskgroup on RAC Cluster or Standalone ASM Configuration
  8. Linux OS Service ‘iptables’
  9. imagemagick for image optimization
  10. How to disable auto deletion of the files in /tmp and /var/tmp directories in CentOS / RHEL 5,6

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright