Doctor Bob
Linux Topic
Search

 
TOURBUS
HOME PAGE
SAVVY
CONSUMER
FREE TECH
SUPPORT

LINUX COMMANDS

How Can I Join Files Together?

The cat command's primary function is to concatenate, or join, files, but you can also use it to display a file on the screen. The cat command takes one or more files that you specify, smashes them together, and then sends the resulting file to the standard output device (without changing any of the original files).
The standard output device is your screen, but by using the greater-than (>) operator, you can redirect cat's output to another file. Here are some examples:

cat food   Display the food file on the screen.

cat scratch fever   Join the files scratch and fever and then displayt he result on the screen.

cat eats bird > DetailsAt11   Join the files eats and bird and save them in the file DetailsAt11.

Note that the original files that cat joins are not modified. For example, say the file eats contained these lines:

The Owl and the Pussy-Cat went to sea
In a beautiful pea-green boat.

Also say the file bird contained these lines:

They took some honey, and plenty of money
Wrapped up in a five-pound note.

After the preceding command, neither file would change, but a new file called DetailsAt11 would be created, containing all four lines:

The Owl and the Pussy-Cat went to sea
In a beautiful pea-green boat.
They took some honey, and plenty of money
Wrapped up in a five-pound note.

For more information on the cat command, see the cat manual.

Previous Lesson: Printing Linux Files
Next Lesson: Searching for Files

[ RETURN TO INDEX ]




Ask Bob Rankin - Free Tech Support
<Send This Link to a Friend>         <Help>         <Bookmark This Page>


Copyright © by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.