Text vs. Non-Text vs. PostScript
1. Text vs. Non-Text
Text files, also referred to as
plain text or ASCII,
consists of normal words/numbers/punctuation.
You can edit such files with the simplest text
editors (vi, emacs, pico, nedit).
Email messages are text,
Fortran source code is text,
shell scripts are text,
even the following ``ASCII art'' is text;
_____ . _ .
/# /_\_ |\_|/__/|
| |/o\o\ / / \/ \ \
| \\_/_/ /__|o||o|__ \
/ |_ | |/_ \_/\_/ _\ |
| ||\_ ~| | | (____) | ||
| ||| \/ \/\____/\__/ //
| |||_ (_/ ||
\_// | | ||
|| | | ||\
||_ \ \ //_/
\_| o| \_______//
/\___/ __ || __||
/ ||||__ (____(____)
(____)_) /***********\
----------------------
Happy Happy Joy Joy
In short, if you can type it on a keyboard or typewriter, it's text.
The following image is NOT text;
nor is the file ``a.out'' that I
get when compiling a C++ or Fortran program.
Such nontext files are also called binary files.
Here's what you do with a plain text file;
- You can email it in unchanged form
- Display its contents on the terminal using
more or cat
- Edit its contents using
vi or pico or emacs or nedit
- Scan its contents for a certain phrase using
grep, e.g.,
grep "diagonal matrix" thesis.txt
- Print it using
enscript
2. PostScript Files
PostScript files are,
strictly speaking, text files, but a special
kind of text file containing commands in the
PostScript page-description language.
Unless you learn the PostScript language,
the contents of such a file may bewilder you;
however, here are some simple tips.
- PostScript files should be named with
the suffix .ps or
.eps
(but Unix doesn't enforce naming rules).
- PostScript files always begin, on the
very top line, with the two characters %!.
This is how a printer knows that the text in the
remainder of the file should be interpreted according
to the rules of PostScript
- Rather than view the textual contents of a PostScript file,
use ghostview to view the page/graphic
which the PostScript commands describe, e.g.,
ghostview graph.ps
- Print it using
lp,
unless it is ``encapsulated'' PostScript
(the latter is intended only for inclusion in
documents)
- Edit it only if you have sufficient understanding of
the PostScript language.
PostScript files are usually generated by
word processing or graphics programs rather than
by hand, so they tend to be unfriendly to
the would-be human text-editor.
3. Non-Text Files
Non-text or binary files,
neither plain text nor PostScript,
cannot be printed directly.
Many binary files, like compiled programs or audio files,
do not have visual content and are never intended to be printed.
Others, like image files in JPG or PNG format,
can only be printed from within graphics/viewing software,
unless they are explicitly converted to PostScript
and the resulting file printed with the lp command.
JPEG and PNG images can be converted to PostScript,
on Unix computers, by commands like
convert
or xv.
Also, heavy-duty software like
IDL or Mathematica or Matlab can read and display
images from JPG and PNG files; from there you can
convert and/or print according to that software's
usual methods.