One of the basic functions of the PTC MKS Toolkit is text processing. Since most PTC MKS Toolkit utilities use text files in some way, creating and manipulating such files is a useful skill when creating almost any kind of PTC MKS Toolkit-based solution.
PTC MKS Toolkit provides several text processing utilities to handle any variety of text processing jobs, such as editors like the fully interactive vi editor, simple text formatting utilities like c, banner, or fmt, and complex formatting systems like groff and its related utilities. The vi Screen Editorvi is a complex and powerful text editing tool. From simple text entry to complex text processing tasks like macros, vi can handle it all. You can even call other PTC MKS Toolkit commands from within vi to perform their actions on a selected portion of text.To help you in learning how to use vi, the ROOTDIR/sample/guide directory contains an interactive tutorial in the files browse.v, edit.v, doc.v, and program.v. To use the tutorial, simply view the files in the order listed using vi itself. In addition to the standard vi editor, PTC MKS Toolkit also includes vi for Windows (viw), which adds Windows functionality such as mouse-controlled cut-and-paste, scrollbars, and printing to vi's standard features. The sed UtilityWhen you need to perform the same editing task (such as replacing one text string with another) on multiple files, a utility like sed comes in handy.The sed utility is a non-interactive stream editor. You do not use it in an interactive session like vi, but rather provide it with a list of editing commands either in a file or on the command line, and sed then provides those commands on a specified group of text files. Searching for TextOften, when dealing with a large number of text files, it's useful to be able to quickly see which files contain a specified string of text or a string of text that matches a specified pattern known as a regular expression. For such purposes, PTC MKS Toolkit contains the grep family of utilities.The fgrep utility searches for lines in files that contain a specified string of text; the egrep utility searches for lines in files that contain a string that matches an enhanced regular expression; and the grep utility, by default, searches for lines in files that contain a string that matches a basic regular expressions. With the use of options, these utilities can simply report a list of files that contain matching strings or the number of lines in each file that contain matches. Finally, the Ultragrep graphical utility (ugrep) lets you search a selection of files that match a given pattern for lines that contain a string that matches a regular expression. Simple Text Formatting UtilitiesPTC MKS Toolkit contains several utilities designed to provide text formatting capabilities including:
Displaying Text FilesPTC MKS Toolkit contains several utilities for displaying text files including:
The groff Formatting SystemThe GNU groff formatting system consists of the groff utility and its related utilities. It takes a text file containing special mark-up commands and produces output in a variety formats such as PostScript® and HTML. In addition to the standard formatting commands available, groff also lets you define macro packages that let you simplify the mark-up of your text file by assigning groups of commands to a single new command. The groff formatting system includes several pre-defined macro packages for purposes such as writing man pages, papers, and memos. These groff formatting system (including groff, the related utilities, and the pre-defined provided as samples in the samples directory on the MKS Toolkit CD.Other Text Manipulation UtilitiesIn addition to the utilities already described, PTC MKS Toolkit contains a variety of utilities that manipulate text files:
|