32
98
Mark Files with Search Results
This command is only available after you have previewed or executed an action. It removes all inclusion and
exclusion marks, and then individually marks for inclusion all files in which search matches were found
during the previous action. These files are indicated in the files and folders tree by "(matched)", after the
name of the file. Since the files are all individually marked for inclusion, file masks are ignored.
Exclude Files with Search Results
This command is only available after you have previewed or executed an action. It marks all files in which
search matches were found during the previous action to be excluded from the next action. Any folders that
were marked for inclusion remain marked after using this command. Essentially, this command allows you to
search again through the same set of files, minus those files in which you just found some search matches.
Search through Archives
This option is on by default. Toggle it to enable or disable searching through archives. When on, archives are
treated as (compressed) folders, and PowerGREP will search through the files inside the archive. When off,
archives are ignored completely. Since PowerGREP treats archives as (compressed) folders, you cannot use
the file masks boxes on the File Selector to include or exclude them. You have to use the Search through
Archives menu item. If an archive contains other archives, the files in those other archives will be searched
through as well. PowerGREP can search through archives inside other archives without restrictions.
These rules does not apply when you execute a list files action without a search text, a file name search action,
or a rename files action and you have the Search through Archives option turned off. In those situations,
PowerGREP will treat archives as ordinary files.
You can configure which files PowerGREP treats as archives in the Archive Formats Preferences.
Search through Binary Files
This option is off by default. Toggle it to enable or disable searching through binary files. This option is
ignored when you set the search type to ´binary dataµ. In that case, binary files are always searched.
You can influence which files are treated as binary files in the text encoding preferences. By default,
PowerGREP will check the first 64K of each file for NULL bytes. If a NULL byte is found, PowerGREP
treats the file as a binary file. Text files should not contain NULL bytes, while binary files frequently contain
NULL bytes.
Since PowerGREP does not know whether a file is binary before reading the file, the File Selector does not
indicate whether a file is binary or text. Even when not searching binary files, those files will have tick marks
in the file selector. The results will indicate skipped binary files.
29
99
Search Only through Files with Results
Turn on this option to limit the next search to files that are listed in the search results. The files must also be
marked for inclusion in the File Selector. If there are no previous search results, this option is ignored.
This option is useful to further narrow down search results. E.g. if you first search for ´Joeµ, and then turn
on ´search only through files with resultsµ without making any other changes to the file selection,
PowerGREP will restrict the search to those files containing ´Joeµ. If you then search for ´Jackµ, you will get
a list of files containing both ´Joeµ and ´Jackµ.
If you know in advance that you only want files with both ´Joeµ and ´Jackµ, turn on the ´list only files
matching all termsµ option on the Action panel instead.
Another way to use this option is to speed up executing an action for real after previewing it first. If you
know none of the files were modified since you did the preview, turn on this option so PowerGREP doesn’t
needlessly search files without matches again.
Show All
Show all files and folders in the files and folders tree. Use this mode when deciding which files and folders to
include in the next action.
Show Included Files
Show only files and folders that are directly or indirectly included, as well as their parent folders and drives, in
the files and folders tree. Use this mode to reduce clutter when inspecting the results after you have
previewed or executed an action.
Show Files with Results
Show only files in which search matches were found during the previous action, as well as their parent folders
and drives, in the files and folders tree. These files are indicated by "(matched)" after the name of the file. Use
this mode to reduce clutter when inspecting the results after you have previewed or executed an action. If no
matches were found, the files and folders tree will be blank.
Show Folders
Show only folders in the files and folders tree. All folders are shown. No files are shown. Use this mode when
you want to mark folders to be included in the next search and long lists of files are making the files and
folders tree unwieldy.
36
100
Refresh
PowerGREP’s File Selector automatically tracks changes to files and folders. Normally, there’s no need to
manually refresh the File Selector. Drive letters appear and disappear immediately when you insert and
remove drives. When you collapse and re-expand a folder node, that folder is automatically refreshed if
Windows notified PowerGREP that files or folders inside that folder were changed. When you execute an
action, all files and folders that you marked to be part of the action are automatically refreshed as needed.
The only situation in which PowerGREP’s File Selector won’t be refreshed automatically is in the rare event
that Windows does not notify PowerGREP of (all) changes to a particular drive. Should that happen, you can
select the Refresh item in the File Selector. This tells PowerGREP to discard all information it keeps about
files and folders. If you execute an action after refreshing the File Selector this way, PowerGREP will glob all
folders in the action again, forcing file listings to be up-to-date.
Edit File
Opens the selected file in PowerGREP’s built-in file editor. The editor can edit both text and binary files.
If you prefer to use an external editor or application to view or edit the file, first configure the editor or
application in the external editors preferences. You can then click on the downward pointing arrow next to
the Edit button on the toolbar, or the right-pointing arrow next to the Edit item in the File Selector menu, to
open the selected file with that application. The applications that are associated with that file type in Windows
Explorer are also listed in the Edit submenu.
If you configured an external editor as the default editor, then the Edit File command will invoke that editor
instead of using PowerGREP’s built-in editor. This saves you having to go through the Edit File submenu.
Open File in EditPad
Opens the selected file in EditPad. EditPad is a most convenient text editor. Just like PowerGREP, EditPad
has been designed by Jan Goyvaerts and is sold by Just Great Software Co. Ltd. EditPad is available at
http://www.editpadpro.com/.
Delete Files
The Delete Files submenu of the File Selector menu allows you to delete four sets of files:
1.
Delete Selected Files and Folders: Delete the files and folders that you have selected in the File
Selector, whether they were part of the previous action or not.
2.
Delete Matched Files: Delete all the files in which search matches were found during the previously
executed action.
3.
Delete Unmatched Files: Delete all the files that were searched through but did result in any matches
during the previously executed action.
29
101
4.
Delete Target Files: Delete all target files that were created during the previously executed action.
Note that this is not the same as undoing the action. PowerGREP’s undo history restores backup
files. Deleting target files in the File Selector does not.
All four options ask for confirmation before actually deleting any files. The confirmation lists the files that
will be deleted and gives you the option between moving the files to the Windows Recycle Bin or
permanently deleting the files. Neither choice allows you to undo deleting the files in PowerGREP. If you
choose to move the files to the Recycle Bin, you can recover the files manually from the Recycle Bin icon on
your Windows desktop, at least until you make the Recycle Bin empty.
Copy Files
The Copy Files submenu of the File Selector menu allows you to copy four sets of files:
1.
Copy Selected Files and Folders: Copy the files and folders that you have selected in the File Selector,
whether they were part of the previous action or not.
2.
Copy Matched Files: Copy all the files in which search matches were found during the previously
executed action.
3.
Copy Unmatched Files: Copy all the files that were searched through but did result in any matches
during the previously executed action.
4.
Copy Target Files: Copy all target files that were created during the previously executed action.
All four options show a screen listing all files that you are about to copy. You can specify the destination for
the copied files and whether backups should be created for any files that are overwritten. These are the same
target destination and backup options as on the Action panel.
After the files are copied a new item appears in the Undo History. There you can undo copying the files if
you choose to create backups, or if no files were overwritten during the copy operation. The Undo History
also allows you to clean up backup files when you’re sure you don’t want to undo the operation.
5
102
Move Files
The Move Files submenu of the File Selector menu offers the same options as the Copy Files menu. It shows
the same screen with options. The only difference is that the files are moved rather than copied to their new
locations. Move operations are also added to the Undo History.
11
103
5. Action Reference
The Action panel is the place where you define the task that PowerGREP will execute. The Action panel uses
a dynamic user interface. Options that do not apply to the action you are defining will be invisible. This
reduces clutter and confusion, and leaves more space to enter long lists of search terms. Since changing some
of the options will make other options relevant or irrelevant, changing an option is likely to cause the Action
panel to change its appearance.
All the options on the Action panel are arranged into nine parts. The parts are laid out from top to bottom in
the order that PowerGREP uses them when you execute the action. Some parts are not available for certain
action type. So when defining an action, start with selecting the action type at the top. Then work your way
through the Action panel from top to bottom.
11
104
1.
Action type: Tell PowerGREP what kind of action you want to execute: ´simple searchµ, ´searchµ,
´collect dataµ, ´list filesµ, ´rename filesµ, ´search-and-replaceµ, ´search-and-deleteµ, ´merge filesµ, or
´split filesµ. Options that are specific to certain action types appear in this part when you select the
action type. Some action types are more flexible than their names imply. E.g. the ´list filesµ and
´rename filesµ action types can also copy files if you choose that target type.
2.
Filter files: Prior to performing the actual action on a file, search through that file’s contents to
determine if this file should be processed or skipped. Since named capturing groups carry over from
the filtering part to all following parts, you can also use the ´filter filesµ feature to capture a part of
41
105
the file’s text to be used in the following parts of the action. The ´filter filesµ part is available for all
action types except ´simple searchµ.
3.
File sectioning: You can make the main action search through only part of each file, or split up each
file any way you want, rather than searching the whole file at once. A common choice is to process
files line by line. Available for all action types except ´rename filesµ.
4.
Main action: The main part of the action is the set of search terms that perform the action you
selected in the ´action typeµ part. All action types have a main part. All action types except ´list filesµ
and ´merge filesµ require at least one search term in the main part of the action. When you set the
action type to ´simple searchµ, the main part of the action is the only part where you can enter search
terms.
5.
Extra processing: Only used for ´search-and-replaceµ, ´rename filesµ, and ´collect dataµ actions. You
can apply an extra search-and-replace to the replacement text or the text to be collected in the main
action.
6.
Context: PowerGREP can display extra context around each search match on the Results panel if
you use the ´contextµ part of the action to collect that context.
7.
Between collected text: Specify whether search matches collected into target files should be delimited
with certain text and whether the target files should have header or footer text. Only used for the
´searchµ, ´collect dataµ, and ´merge filesµ action types and only when ´target file creationµ is set to
anything except ´do not save results to fileµ.
8.
Target and backup files: Tell PowerGREP where it should save collected search matches, whether
you want to modify the original files or create a new set of target files, or whether you want to copy,
move, or delete the listed files. The available options depend greatly on the action type and can even
change its apparent function. E.g. selecting the ´delete matching filesµ target type in combination
with the ´list filesµ action type essentially changes the action into a ´delete filesµ operation. Only the
´simple searchµ does not have any target options at all.
9.
Comments: Enter a description of the action’s purpose before adding it to a PowerGREP Library or
saving it into an action file.
When you’re done defining the action, use the Preview, Execute or Quick Execute items in the Action menu
to execute it. The Preview item is the safest one, since it will never modify any files, or do anything else you
might regret.
The buttons on the Action toolbar that correspond with the Execute and Quick Execute menu items change
their labels to indicate exactly what will happen. The labels change whenever you change the action type or
target type.
Documents you may be interested
Documents you may be interested