掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 390|回复: 0

[教程] powergrep 001

[复制链接]

该用户从未签到

发表于 2017-11-18 08:50:11 | 显示全部楼层 |阅读模式
Action Reference9 u6 X' Q( p" U, f. l
- a3 O7 R: A. Q  K7 @/ p4 W9 [) X
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.
* T9 G& Z4 y% k$ _7 A1 ~* n# }! t$ C/ I! L; F: {" K' Q6 Q6 J9 [
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.+ D  H/ R# B9 P- L. S
) _) F( O  n6 }0 F
Action panel showing all nine parts1 _1 [/ J3 t+ h; Z/ R

+ f  t( v- c! `+ Y: e: C' j6 sAction type: Tell PowerGREP what kind of action you want to execute: "simple search", "search", "collect data", "count matches", "list files", "file or folder name search", "file or folder name collect", "rename files or folders", "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. The "list files" and "rename files and folders" action types, for example, can also copy files if you choose that target type.
! X6 z, ?0 v6 a" I* p& v; sFilter 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 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".) E  \1 I- s. M
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 or folders".
! y$ K6 ?; y$ Z) U& SMain 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", "file or folder name collect", and "merge files" require at l** 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.0 |6 V# L6 _  u
Extra processing: Only used for "collect data", "file or folder name collect", "search and replace", "rename files or folders", and actions. You can apply an extra search-and-replace to the replacement text or the text to be collected in the main action.
0 u6 h; e# K% {8 s/ m! s- AContext: 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. Only used for actions types that display search matches found in the contents of files.5 }! G: ^0 |6 p) x
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", "file or folder name collect", and "merge files" action types and only when "target file creation" is set to anything except "do not save results to file".6 P( Y9 |( F# s# h
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 **ly on the action type and can even change its apparent function. Selecting the "delete matching files" target type in combination with the "list files" action type, for example, essentially changes the action into a "delete files" operation. Only the "simple search" does not have any target options at all.. l2 t0 u( e$ ?5 ?5 ]. c0 L. R; v
Comments: Enter a description of the action's purpose before adding it to a PowerGREP Library or saving it into an action file.# a$ h. F% S! N9 A7 F; t7 r
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 never modifies any files, or do anything else you might regret.
6 t2 z7 Q% B. F/ o( t+ _' _9 k1 ?* g8 D* X* W3 a' R- y% r4 z
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. When the action type is "rename files", for example, the word "Execute" changes into "Rename" or "Copy" depending on whether the target type is "rename files" or "copy files".2 h5 ~1 z; K2 I; s
9 k) v* n! J3 N
Discuss5 X' A$ l, h. X7 M$ {( v4 F
* _9 u9 z$ m" ]" i/ q/ c
Start or join the conversation on the topic "Docs: Action Reference" in PowerGREP's discussion forum.
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

小黑屋|手机版|Archiver|PDAWIKI |网站地图

GMT+8, 2024-4-24 09:54 , Processed in 0.029704 second(s), 9 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表