Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/ftp/documents/system-docs/vms-guide/html/VUG_33.html
Дата изменения: Wed Nov 1 17:38:24 1995
Дата индексирования: Sun Dec 23 18:30:20 2007
Кодировка:

Поисковые слова: scientist
Other Text Tools



Editing Files

Other Text Tools


SEARCH

The SEARCH command finds
text strings in files and displays any lines it finds that match the text string. Two arguments are used: the filenames to be searched and the text strings to be found; wildcards and lists of files can be used to search multiple files, and several text strings can be simultaneously matched--each string is separated by a comma. For example, to find the string "AGN" in all TEX source files in the current directory, you could use the command:

$ SEARCH *.TEX AGN
If you wanted to look for complex strings with embedded blanks, you need to use quotes. The /WINDOW qualifier specifies the number of lines to be displayed before and after the text string. For example:

$ SEARCH *.TXT "WEEKLY REPORT 12" /WINDOW=(2,1)
Instead of having the text lines in which the strings are found displayed to your screen, you may want to save the results in an output file. You can do this using the /OUTPUT qualifier. For example:

$ SEARCH/OUTPUT=RESULTS.TXT *.TEX Weekly,Monthly
A number of other qualifiers are available to help you restrict your search, for example, by file owner or file creation date. Information about these features are available in the online help files by typing:

$ HELP SEARCH
A simple example of how the SEARCH command could be used is shown in Figure
4.9.



Figure 4.9: Finding Text with SEARCH

DIFFERENCE

The DIFFERENCE command
can be used to compare two files and find lines that do not match. This can be especially useful, for example, for finding out what changes were made between two versions of the same file. While DIFFERENCE usually expects two filenames on the command line, by specifying only one, the program compares the two highest versions with the same file name.

You can save the output from DIFFERENCE to a file by using the /OUTPUT qualifier. You can either specify a filename in which differences should be saved, or the program uses the rootname of the first file being compared and appends a file type of .DIF. The following example shows how to use the command, saving results in a file called OUT.DIF:

$ DIFFERENCE/OUTPUT=OUT.DIF FILE1.TXT FILE2.TXT
Options are also available to have the program display the files side by side, in hexadecimal format, to search only a limited number of lines, to include line numbers or change bars in the output, and other functions. These options and the qualifiers used to enable them are
described in the online help.

Figure 4.10 shows an example of how the DIFFERENCE command can be used to compare two text files.



Figure 4.10: Comparing Two Files with DIFFERENCE





SEARCH
Figure 4.9: - Finding Text with SEARCH
DIFFERENCE
Figure 4.10: - Comparing Two Files with DIFFERENCE

Generated with CERN WebMaker