Tuesday, January 24, 2012

join command

   join command is used to join  two files based on a key field present in both the files. The input files can be separated by white space or any delimiter. join can be looked at like the join functionality in any RDBMS(database). However, the only difference being in the database join we get only the columns which we give in the select clause, in case of unix join, you get all the columns of both the files. And yes, the join can be done using only one key field, not multiple.

1. Let us consider 2 sample files a1 and a2. a1 containing bank account numbers and the balance in the account. a2 containing bank account numbers and the account names.