O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.4. Using join

Join lets you join lines together from two sorted text files. The join command may be familiar to you if you are into SQL.

Here’s how join works. You have two files, file1 and file2, sorted of course. Both files have a common element in them that relates to the other file. Using this relationship, the join ‘folds’ the two files together. It’s a bit like updating a master file, or updating any file that holds elements that are common to both files.

The fields within the text files are normally separated by tabs or spaces, but you can specify another field separator if you like. Some systems say you should not have more than 20 fields in a file when using join; to be honest, if you’ve got more than 20 fields anyway you should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required