Linux Shell Scripting Tutorial (LSST) v1.05r3
Prev
Chapter 5: Essential Utilities for Power User
Next

The join utility

Now enter following command at shell prompt:
$join sname smark
11   Vivek       67
12   Renuka    55
13   Prakash  96
14   Ashish     36
15   Rani        67

Here students names are matched with their appropriate marks. How ? join utility uses the Sr.No. field to join to files. Notice that Sr.No. is the first field in both sname and smark file.

General Syntax of join utility:
Syntax:
join {file1} {file2}

Use of join utility:
The join utility joins, lines from separate files.

Note that join will only work, if there is common field in both file and if values are identical to each other.


Prev
Home
Next
Putting lines together using paste utility
Up
Translating range of characters using tr utility