O'Reilly logo

Practical UNIX by Steve Moritsugu - DTR Business Systems

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

Combining Files

Several commands that can combine file contents for various purposes will be covered in this section. The files can be combined and intertwined in sorted order. They can be concatenated one after the other. They can be pasted side by side on each line or joined side by side where a line in one file is paired with the corresponding line in a second file. These combinations do not affect the original files. The results can be redirected and saved in another file, if desired.

Sorting Multiple Files Together

You looked at sort at the beginning of this chapter. If sort is called with a list of files on the command line, sort first merges their contents and then displays the combined contents in sorted order, as shown here:

sort file1 ...

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