Performing Searches with Find in Files
Contents of Article
The Find in Files command FF is issued from the File Manager, and is used to search all currently displayed file names for a string value. You can search a directory list, the Recent Files File List or any other File List.
The FF command searches every file that is displayed in the current list. You have a number of options to manage and selectively search File Lists.
- To search a ‘selective' list of files, you can start with a directory list and use the File Patterns field with one or more wildcards to reduce the number of displayed files. You can also add files to a favorites list with the A or ADD line command or the FAV edit primary command, and then issue the FF command while the Favorite Files List is displayed.
- If you search a File List, you can remove files from the list before issuing the FF command, to avoid finding a string in a given file in three ways:
- with the Forget line command F. Keep in mind that if you do this, the file will be permanently removed from the File List. This only removes a name-entry in the File List, but does not delete the file itself. (A FORGET can be reversed using the RESET F command for the File List)
- with the Exclude line command X. Excluded lines are hidden only for the current display of this File List, unlike F Forgotten files. (An EXCLUDE can be reversed using the RESET X command for the File List)
- with the File Manager Primary command EXCLUDE / X, which allows you to Exclude files based on a File Pattern operand, handy for bulk excludes of particular format file names.
- If an existing File List is close to what you want, but not exactly, you can Clone a File List, which allows you to edit the list of file names it contains, and then save that File List under a new name. You then would click on Named Favorites to see the new File List you just created. You might wish to clone a File List if you wish to tailor the list of files it contains without permanently deleting them.
- If a given directory display has the files you are interested in searching, and you wish to search this list repeatedly, you can issue a MAKELIST command to create a named-favorites File List. Remember that MAKELIST can either create a fixed list of files that are currently displayed on a directory list, or it can create a Symbolic "Shortcut" file list using the SYM keyword option.
If the FF command finds at least one matching file, it creates (or updates) the Found Files File List and then displays it.
You can issue the FF command starting from the Found Files File List itself, to search files that were found by a prior FF command. If you do this with different search strings, you will successively refine the list. That is, if you issue FF ABC, then FF DEF, then FF XYZ, you will end up with a new Found Files File List that only shows files that contain all three strings ABC, DEF and XYZ. No matter how many times you use the FF command, there is only one Found Files File List.
The Find in Files command FF uses a syntax similar to the editor FIND command.
Note: The new FF alias for the edit FIND command should not be confused with the File Manager Find in Files command FF, which is completely different, and has nothing to do with the Edit FIND and FF commands.
FF string [ start-col [end-col] ] [ CHARS | WORD | PREFIX | SUFFIX ] [ NF ]
Any string value accepted in an edit session is permitted here. The string may be unquoted, or quoted without a string type, or may be quoted with a string type of C, T, X, P or R.
Unquoted strings, or string quoted without a string type, will be treated as either C or T, depending on the Case C/T code that appears on the SPFLite status line. The Case C/T code for the File Manager can be changed by the CASE C/T command, as in an edit tab.
Left column of a range (with end-column) within which the search-string value must be found. If no end-column operand, then the search-string operand must be found starting in start-col.
Right column of a range (with start-column) within which the search-string value must be found.
CHARS | WORD | PREFIX | SUFFIX
Specifies the ‘search context' for the string, the same as is done for the FIND command in the editor.
If not specified, a CHARS search is done if the status line shows C or T, and a WORD search is done if the status line shows C W or T W. These two defaults can be set by the FIND CHARS and FIND WORDS commands, as in an edit tab.
If the NF option is used, a search is made for files that do not have the string present on any line.
Let's say you have three files in a Named Favorites File List called PROJECT, and you want to know which files have the string ABC in them. Click on the File Manager tab and then on the line with PROJECT File List. You will see a display something like this:
Assume that only FILE2.TXT has the string you are looking for. You would issue a File in Files command:
You will see a popup window while the search is going on. When finished, the popup will go away, and you will see a display like this, as SPFLite now displays the Found FIles File List:
You can now use the Found FIles File List to issue any File Manager line command, or click on the name to open the file for editing.
Created with the Personal Edition of HelpNDoc: Qt Help documentation made easy