Editing Text Files
Text files (also referred to as ``ASCII files'' or
``plain text files'') are those which contain only
typed text -- letters, digits, punctuation, spaces
and tabs -- with no formatting extras like font
information or graphics.
In contrast, the following are
binary files,
i.e., NOT text files:
- Word processor documents (produced by Word or Wordperfect or StarOffice)
- spreadsheet files
- compressed images files (PNG or JPEG)
- Compiled/executable Fortran or C programs
- Compiled/executable object/library files (suffixes .o, .a, .so)
- compressed/archive files (suffixes .gz, .tar, .Z, .sit)
- DOS/Windows executable files (suffix .EXE)
Text files are special in that they are the lingua franca
of file formats -- all computers can do stuff with plain text,
whereas other formats are usually peculiar to
specific software or specific computer architectures.
(Unfortunately, there are slight differences between
Unix, Mac, and Wintel text newlines.)
Text files can be sent without modification in the body
of email; they can be displayed in simple text windows;
they are the basis of all computer work and are cannot
be proprietary to any software company.
Editing text is the most important single activity involving
text files, but there are lots of cute Unix commands to do
other stuff with text.
Text Editors
Word processors (StarOffice, Word, WordPerfect, etc.) can edit
text files but are unnecessarily large and complicated.
Because text files are as simple as files can get (much
simpler than standard word-processor documents), they should
be edited with the trimmer, simpler, more streamlined
text editors, of which there are several:
- vi
- This is a powerful editor available on
all Unix computers. It does not make
use of the mouse or windows or menus -- it is purely
keyboard-based. Every key on the keyboard either
performs an operation or inputs a character into the
file, depending on which mode vi
is in. Vi requires some time to learn, but
it is worth it.
(Sometimes it is the only text editor available.)
On the Newton Lab Sun workstations there are two VI
tutorial programs you can run; type either
``vitutor'' or ``vilearn''
at the Unix prompt. Or, see links
to more tutorials and manuals and reference pages.
A supercharged version of vi called
vim is also available on many Unix
computers, and is even available for Mac and PC computers!
- emacs
- Even more powerful than vi, but
even more complicated. Emacs is on almost
all Unix computers, and it too uses only keyboard.
(You have to use a keyboard-only editor when you are
editing your files via the internet.)
- pico
- This is the keyboard-only editor used in the
pine email program. If you use pine,
then perhaps you are familiar enough with
pico to use it as an editor without going nuts.
- nedit
- If you are sitting at a workstation (rather than
accessing the workstation via ssh) then
you can use the graphical user interface -- windows,
mouse, menus, bells & whistles -- with the fancy
text editor nedit.
- xedit and others
- There are other text editors which make use of
the windowing system, mouse, etc.;
xedit, textedit and others.
However, there is no reason to use these rather
than nedit.
For all of these, the usual way to invoke the editor is to
type the command plus the name of the existing or new text file,
e.g.,
- vi prog.f
- emacs prog.f
- pico prog.f
- nedit prog.f
All of these editors provide ways to save work
and to open old or new files from within the editor.