www.riscos.com Technical Support: |
|
Find searches both the names and the contents of one or more files for text patterns. It includes options allowing you:
Clicking Select on the application icon or dragging the name of a file from a directory display to the icon brings up the SetUp dialogue box:
The Patterns writable icon allows you to type in the patterns to be searched for.
If a single pattern includes spaces, the pattern must be enclosed in double quotes, for example:
"the text"
Double quote characters in a search pattern must be preceded by a backslash.
The Files writable icon allows you to specify the name of one or more files (typed in or dragged from a directory display) to do the searching in.
Line count only prints only a count of the number of lines matching the pattern from the specified files.
Filenames only lists only the names of files matching the pattern.
Case insensitive will ignore the case of letters; for example, normal and Normal would be considered as identical if this option was chosen.
Verbose lists the name of each file before searching it for pattern matches.
Throwback enables SrcEdit throwback when text selections are found.
Clicking on Wildcards displays a further set of options:
The options listed under Pattern Wildcards allow you to specify wildcarded expressions in your search string. Clicking on one of these options will insert a special character into the Patterns writable icon immediately before the caret.
The options offered under File Wildcards insert special characters into the Files writable icon which allow you to specify files in a variety of ways. Several of these options require you to manually insert additional text next to or inside these special characters:
Filename ch. # inserts a hash character immediately before the caret. This character will match any single filename character except .
For example:
Find adfs::HDisc4.$.Fred#
will search files Fred1 and Freda, but not Fred13, Frederick etc.
Find adfs::HDisc4.$.Fr#d
will search files Fred and Fr2d, but not Fre1d, Freed etc.
0orMore filename chs. * inserts an asterisk immediately before the caret. This character will match any sequence of filename characters except ., {, and }.
For example:
Find adfs::HDisc4.$.Fred*
will search files Fred1 and Freda, and also Fred13, Frederick etc.
Find adfs::HDisc4.$.Fr*d
will search files Fred and Fr2d, and also Frd, Freed, Fr123d etc.
Sub-directories ... inserts three dots immediately before the caret. It must be positioned immediately after a directory name. Find will then search all nominated files in that directory and in any subdirectories in that structure.
For example:
Find adfs::Amy.$.Receipts...monthly
will search all files called monthly in the directory Receipts and also in any subdirectories of Receipts.
Or { inserts a left brace immediately before the caret.
Or } inserts a right brace immediately before the caret.
The preceding two options insert opening and closing braces into the Files writable icon. You can then manually insert one or more filename characters between these braces, separating each filename with a comma. Find will then search all filenames inside the braces.
For example:
Find adfs::HDisc4.$.W.rel.{atype,btype,ctype}
would search all three files inside the braces, i.e. atype, btype and ctype.
0 or More ( inserts a left bracket immediately before the caret.
) 0 or More inserts a right bracket immediately before the caret.
The preceding two options insert opening and closing brackets into the Files writable icon. You can then manually insert one or more filename characters between these brackets and Find will search any files with none, one or more occurrences of the characters you put inside the brackets.
For example:
Find adfs::HDisc4.$.Fr(e)d
will search files Frd, Fred and Freed, but not Frid.
Find adfs::HDisc4.$.Fr(ie)d
will search files Frd, Fried and Frieied, but not Frid, Frieed or Fred.
Clicking Menu on the SetUp dialogue box displays the menu shown on the left.
Command line option - see Command line interface.
The Allow '-' option enables you to specify another pattern which will be matched even if it begins with a -. This pattern will be searched for in conjunction with the patterns you have inserted into the Patterns writable icon.
If you need to match two or more patterns beginning with a -, then you must precede each additional pattern with -e
For example:
-pattern -e -pattern -e -pattern
Grep style enables you to specify patterns using the syntax of the UNIX grep tool. This option is provided for users familiar with UNIX.
Clicking Menu on the Find application icon gives the following options:
For a description of each option in the application menu see the chapter entitled General features.
Note that Auto Run and Auto Save are not available for this application.
The output of Find appears in one of the standard non-interactive tool output windows. For more details of these see the chapter entitled Output.
The following window shows an example of the output from Find:
In the above example the pattern MOV[CV] was specified in the Patterns writable icon in order to list only those instructions beginning with MOVV or MOVC in an assembler source file. Instructions where the fourth letter was not a C or V, such as MOVS, MOVNE and MOVEQS, were, therefore, not listed. The Throwback option was not enabled in the above example. With Throwback enabled, a SrcEdit Throwback browser would also have appeared allowing the file Util to be edited, starting at the found lines.
For normal use you do not need to understand the syntax of the Find command line, as it is automatically generated for you from the SetUp dialogue box settings. The Command Line syntax for Find is:
Find [options] [pattern{ pattern}] -f filepattern{ filepattern}
-c | list only a count of the number of lines matching from each file. |
-n | ignore the case of letters when making comparisons. |
-l | list only the names of files matching patterns. |
-v | list the name of each file before searching it for matches. |
-u | accept UNIX grep/egrep-style patterns. |
-e | allow the following pattern arguments to begin with a -. |
. | matches any single character. |
$ | matches the newline character (LineFeed). |
@ | matches any alphanumeric character. |
# | matches any digit. |
| | |c matches Ctrl-c, where c is any character between @ and _. |
\ | matches the following character even if that character is a special character. |
[ ] | matches any character inside the square brackets. |
~ | matches any character other than the following character. |
* | matches 0 or more occurrences of the following character. |
^ | matches 1 or more occurrences of the following character. |
-f | marks the end of multiple patterns and the start of filepatterns. |
# | matches any filename character except . |
* | matches 0 or more filename characters other than . |
... | searches files in that directory and any subdirectories in that directory. |
{,} | searches files contained within braces (filenames separated by commas). |
( ) | search any file with none, one or more occurrences of the characters inside the brackets. |