Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual page 48

Table of Contents

Advertisement

34
Chapter 3. Shell Prompt Basics
Figure 3-7. Joining Files and Redirecting Output
You can see that
has added
where
ended.
cat
home.txt
sneakers.txt
3.8.2. Appending Standard Output
You can use output redirection to add new information to the end of an existing file. Similar to when
you used the
symbol, you tell your shell to send the information somewhere other than standard
§
output.
However, when you use
, you are adding information to a file, rather than replacing the contents
§ ¨ §
of a file entirely.
The best explanation is a demonstration. Take two files which have already been created
(
and
) and join them by using the append output symbol. To add the
sneakers.txt
home.txt
information in
to the information already in
, type:
home.txt
sneakers.txt
cat home.txt
sneakers.txt
©  ©
Now check the file using the command
. The final output shows the contents of
cat sneakers.txt
at the end of the file:
home.txt
buy some sneakers
then go to the coffee shop
then buy some coffee
bring the coffee home
take off shoes
put on sneakers
make some coffee
relax!
The command you typed appended the output from the file
to the file
.
home.txt
sneakers.txt
By appending the output, you save yourself time (and a bit of disk clutter) by using existing files,
rather than creating a new file.
Compare the results of the files
and
, and you can see that they are
sneakers.txt
saturday.txt
identical. To make your comparison, type:
cat sneakers.txt; cat saturday.txt
The contents of both files are displayed — first
, then
(as shown in
sneakers.txt
saturday.txt
Figure 3-8).

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents