These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/The Simplest Editor

Classnotes | UNIX01 | RecentChanges | Preferences

Today we will be looking at some very complicated editors. If you ever find yourself without an editor, or having forgotten how to use an editor, as long as you remember this simple trick, you will be fine.

Recall that the cat command can be used to view a file or to pass the contents of a file (or files) into another file. Well, when run without any commandline arguments it will simply take data from STDIN and redirect it to STDOUT. Thus, you can use it to copy inputted text into a file by using a redirect:

 $ cat > some_file

This will take whatever is typed from the keyboard and place it in some_file. To exit this mode, pass the control sequence CTRL-D (which is the EOF, End of File, character).

Small Project

Go ahead and create file calling it "testfile" and place the following inside of it:

 This is line 1.
 This is line 2.
 This is line 3.
 This is line 4.

Create it using cat and a redirect.



Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 19, 2003 2:05 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.