240 You Are Here
[billy@localhost billy]$ cat saturday
and you should see something like this:
[billy @localhost billy]$ cat saturday
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!
[billy @localhost billy]$
You can see that cat has added home.txt where sneakers.txt left off.
Tip: Creating and combining short files with cat can be a convenient alternative to
using a text editor like pico.
Summary: By using the output redirection symbol (>) you can send the output to a file
instead of the terminal. The cat utility can be used along with output redirection to join
files together into a single, unified file with one filename.
16.8 Appending Standard Output
There’s a neat twist to output redirection which allows you 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’re adding information, rather than replacing it.
The best explanation is a demonstration, so let’s take two files which have already already been
created – sneakers.txt and home.txt – and join them by using the append output symbol. We
want to add the information in home.txt to the information already in sneakers.txt,sowetype:
cat home.txt >> sneakers.txt
Comments to this Manuals