• 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. pidof: command not found
  2. grub2-mkpasswd-pbkdf2: command not found
  3. Sample /etc/multipath.conf file
  4. How to Disable IPv6 on Ubuntu 20.04 Focal Fossa
  5. mailq Command Examples in Linux
  6. aplay: command not found
  7. traceroute Command Examples in Linux
  8. How to change the PATH variable in Linux
  9. Command ‘df -i’ Shows ‘Inode=0’ on BTRFS File System
  10. How to Check if any of the RPM files were tampered with

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright