feed-image  ISSN 1836-5930



Receive Your Complimentary Guide to Linux NOW!


A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)




Poll

Do you care about your privacy when using a FACEBOOK?
 

linuxconfig.org
is hosted by:



Partner Linux Sites
TuxMachines
DebianAdmin
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
FreeSoftwareLinux
All For Linux

join
Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

join [man page] - join lines of two files on a common field

2. Synopsis

join [OPTION]... FILE1 FILE2 

3. Frequently used options

-j FIELD
equivalent to `-1 FIELD -2 FIELD'
-1 FIELD
join on this FIELD of file 1
-2 FIELD
join on this FIELD of file 2

4. Examples

Join command can be as a simple database join table. Suppose that we have two following files, file1:
$ echo -e "0001 =\n0010 =\n0011 =\n0100 =\n0101 =\n0111 =" | nl > file1 
join - create a sample file 1
$ echo -e "one\ntwo\nthree\nfour\nfive\nsix" | nl > file2 
join - create a sample file 2
now we can use join command to join those two files:
$ join -j 1 file1 file2 
join files with join command