Project

General

Profile

Filter » History » Version 3

Per Amundsen, 08/13/2014 10:08 AM

1 1 Per Amundsen
_Added in 1.9.4_
2
3
*/filter [-asdfkwxnpriocteubglLz] [n-n2] [c s] <infile | dialog id> <outfile | dialog id | alias> [alias] <matchtext>*
4 2 Per Amundsen
5 3 Per Amundsen
Scans lines of text in a window, file or dialog control, any matches are then written out to another window, file, or dialog control. 
6
The order of the switch are important, they define what is the infile and what is the outfile, see the examples for more information. 
7
8
The [[$filtered]] identifier will retrieve the number of matches found.
9
10 1 Per Amundsen
*Switches*
11
12 3 Per Amundsen
-w - indicates the parameter is a window
13
-f - indicates the parameter is a file
14
-a - sorts filtered lines by calling the optional [alias] parameter, the alias is passed two lines, $1 and $2, it must compare both and return -1, 0, or 1 to indicate relative sort order of these lines to each other
15
-x - excludes matching lines
16
-n - prefixes lines with a line number (the Nth match)
17
-d - TODO
18
-s - indicates the status window will be used
19
-p - TODO
20
-r - specifies the range of lines n to n2 for filtering
21
-b - strips BURK codes when matching text
22
-g - indicates the matchtext is a regular expression
23
-z - TODO
24
-k - indicates that you have specified an <alias> as the output instead of a window name. The alias will be called with the result of each filtered line with the form $<alias>($1) where $1 is the matched line
25
-i - indicates that you have provided a [dialog id] custom dialog control as the input
26
-o - indicates that you have provided a [dialog id] custom dialog control as the output
27
-c - switch clears the output window/file before writing to it
28
-t - TODO
29
-e - TODO
30
-u - TODO
31
-l - filters from the side-listbox in the first window
32
-L - filters to the side-listbox in the second window 
33
34
*Parameters*
35
36
[n-n2] - if -r is used, indicates the range of lines to be scanned*
37
[c s] - if -t is used, indicates how to do the sort
38
<infile | dialog id> - if no switch implies a window's name to be use as the infile, you must provide an infile (a window, a file, or a dialog control)
39
<outfile | dialog id | alias> - if no switch implies a window's name to be used as the outfile, you must provide an outfile (a window, a file, a dialog control, or an alias name if -k is used)
40
[alias] - optional alias called if -a is used
41
<matchtext> - the expression used for the search, if $null is used, it matches everything. 
42
43
<pre>
44
;filter from the file "c:\my file.txt" to the custom window @mywin
45
/filter -fw "c:\my file.txt" @mywin *findthis*
46
47
;filter from the custom window @mywin to the file "c:\my file.txt"
48
filter -wf @mywin "c:\my file.txt" *findthat*
49
50
;filter from the status window to the single message window
51
/filter -sd *findthis*
52
53
;filter from the single message window to the status window
54
/filter -ds *findthat*
55
56
;filter from the filename @this_is_a_file to the dialog 'dialog', id '1'
57
/filter -fo @this_is_a_file dialog 1 *findthis*
58
59
;filter from a file and call an alias for each line
60
/filter -fk file myalias *findthat*
61
62
;filter from a file to a file using regex
63
/filter -ffg file1 file2 /regex here/
64
</pre>