-->

Previous | Table of Contents | Next

Page 224

example, the sample license document uses the phrase this Package to describe a software package. If you're the software developer of a new game, Nano-Warrior, and need to save time writing copyright licenses, you can change all occurrences of this Package to Nano-Warrior easily and quickly without using a text editor:


# cat LICENSE | sed `s/this Package/Nano-Warrior(TM)/g'

...



1.  You may make and give away verbatim copies of the source form of the

Standard Version of Nano-Warrior(TM) without restriction, provided that you

duplicate all of the original copyright notices and associated

disclaimers.



...

The sed s, or substitute command, is used to search for all instances of the first string, and to replace each instance with the second because of the g, or global, command. The original text file is not changed, and you can save a new version by redirecting the output.

The sed command also is designed to work using editing scripts. To make numerous, regular changes to files, create an editing script and use your script to edit files. Use the sed command's -f, or script file command-line option to use the script:


# sed -f myscipt.sed < form.ltr >output.ltr

JUST A MINUTE
There are too many text filters included with your Linux distribution to discuss in this hour; see the manual pages for the filter commands listed near the beginning of this section. You also may want to experiment with the wc, or word count, program, which reports the number of characters, words, and lines in your text documents.

Applix Words

There are many other Linux word processing programs besides the text editors installed on your system. These programs may be in the public domain, distributed as shareware, or sold commercially. One word processor, Applix Words by Applix, Inc., sold by Red Hat Software, deserves special mention because it

Page 225

Applix Words requires the X Window System (see Figure 14.6). The Applixware suite needs about 135 megabytes of your hard drive space, and 16 megabytes of your computer's memory to run comfortably. Once installed, run Applix Words with the following:

Figure 14.6.
The Applix Words
program from Applix,
Inc. is part of Red Hat
Software's Applixware
suite of office tools
and is a WYSIWYG
word processor with
many different features,
including a
customizable interface
and professional
editing tools for
writers.



# applix -wp

This command line starts the word processor. Applix Words also has a tutorial, like emacs. To start learning, select the Help menu, and then pull down the Tutorial menu item (you also can hold down the Alt key, then press h, followed by the t key).

Find out more about Applix Words by browsing to the following site:




http://www.redhat.com

Spell Checking Your Documents

Misspelled words in your documents can be embarrassing, especially if other people read your text. Correct spelling is an important part of writing and word processing. Just as

Page 226

errors in syntax can cause programming errors, spelling errors can cause problems in miscommunication, and loss of a potential job, customer, or the respect of a supervisor.

Fortunately, your Linux distribution comes with the ispell spelling checker, so you won't have to suffer the embarrassment of misspelling! This section shows you how to correct documents and fix your spelling errors.

Correcting Documents with the ispell Command

The ispell command, found under the /usr/bin directory, is an interactive spelling program you can use alone or with your text editor to correct spelling mistakes. Several editors included with your Linux distribution, such as emacs and pico, are set up to automatically use this program for spell checking, but using ispell by itself is easy. For example, to check the spelling of the file myfile.txt, use


# ispell myfile.txt

The ispell program loads the text, and then displays the first found error in context, along with a single or several suggested replacements:


MERCHANTIBILITY              File: LICENSE



WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF

MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.



 0: MERCHANTABILITY







[SP] <number> R)epl A)ccept I)nsert L)ookup U)ncap Q)uit e(X)it or ? for help

Correct the spelling by either typing 0, the number of the suggested replacement word, or R, to replace the word by retyping it. Look up other words with L, the lookup command, which searches the system dictionary, called words, located under the /usr/dict directory. If you use the I, or insert command, ispell creates a personal dictionary in your home directory, using .ispell_english as a filename.

You also can specify multiple documents on the ispell command line:


# ispell *.txt

This command line causes ispell to load each file ending in .txt for spell checking. If you'd prefer to use ispell as the more traditional UNIX spell command, which reads a document then prints out a list of suspected words, use ispell's -l, or list option, on the command line:


# ispell -l < LICENSE

...

Julianne

Haugh

uunet

uu

MERCHANTIBILITY

...

Previous | Table of Contents | Next