-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

The Ultimate Linux Shell Scripting Guide
By :

Here’s another handy utility you can use to combine two text files. (Unlike the other utilities we’ve looked at, you can use join
for two text files, but no more than two.) To see how it works, take a look at the following diagram with its text files about famous Hollywood actors from a by-gone era. Then, go ahead and create the files, with tabs between the two columns of each file. Then, run the command that’s shown in the diagram.
Figure 6.6: Joining two files together with join
As you see, the join
utility replaces the tabs that were between the columns with blank spaces.
Note that in each of the two input files, the first field is the same. (In this case, it’s the last name of each actor.) In the output, the first field--which we’ll call the key field--is only listed once. The information for each actor’s last name--the key field--is obtained from both of the two input files.
The thing to remember...