From WikiChip
Editing mirc/commands/filter
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | {{mirc title|/filter Command}} | + | {{mirc title|/filter Command}}{{mIRC menu}} |
− | The '''/filter command''' | + | The '''/filter command''' scans lines of text in a window or file, or dialog control, and if any of them matcht the matchext, they are written out to another window or file, or another dialog control which you can then use. The order of the switch are important, they define what is the infile and what is the outfile, see the examples for more informations. You can filter blank lines by specifying {{mIRC|$crlf}} for the matchtext. /filter also fills the {{mIRC|$filtered}} identifier with the number of matches found, if any. |
− | |||
− | |||
− | |||
− | |||
− | |||
== Synopsis == | == Synopsis == | ||
− | /filter [- | + | /filter [-asdfkwxnpriocteubglLz] [n-n2] [c s] <infile | dialog id> <outfile | dialog id | alias> [alias] <matchtext> |
== Switches == | == Switches == | ||
− | + | * '''-w''' - indicates the parameter is a window | |
− | + | * '''-f''' - indicates the parameter is a file | |
− | * '''-w''' - | ||
− | * '''-f''' - | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* '''-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 | * '''-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 | ||
− | |||
* '''-x''' - excludes matching lines | * '''-x''' - excludes matching lines | ||
* '''-n''' - prefixes lines with a line number (the Nth match) | * '''-n''' - prefixes lines with a line number (the Nth match) | ||
− | * '''-p''' - | + | * '''-d''' - indicates the single message window will be used |
− | * '''- | + | * '''-s''' - indicates the status window will be used |
− | * '''-b''' - strips BURK | + | * '''-p''' - wraps the text output in a custom window |
+ | * '''-r''' - specifies the range of lines n to n2 for filtering | ||
+ | * '''-b''' - strips BURK codes when matching text | ||
+ | * '''-g''' - indicates the matchtext is a regular expression | ||
* '''-z''' - retains line colors when filtering between custom windows | * '''-z''' - retains line colors when filtering between custom windows | ||
+ | * '''-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 | ||
+ | * '''-i''' - indicates that you have provided a [dialog id] custom dialog control as the input | ||
+ | * '''-o''' - indicates that you have provided a [dialog id] custom dialog control as the output | ||
* '''-c''' - switch clears the output window/file before writing to it | * '''-c''' - switch clears the output window/file before writing to it | ||
+ | * '''-t''' - switch sorts the output based on [c s], column C using character S as the columns separator | ||
+ | * '''-e''' - used with -t, specifies a descending sort | ||
+ | * '''-u''' - used with -t, specifies a numeric sort | ||
* '''-l''' - filters from the side-listbox in the first window | * '''-l''' - filters from the side-listbox in the first window | ||
* '''-L''' - filters to the side-listbox in the second window | * '''-L''' - filters to the side-listbox in the second window | ||
Line 41: | Line 31: | ||
* '''[n-n2]''' - if -r is used, indicates the range of lines to be scanned* | * '''[n-n2]''' - if -r is used, indicates the range of lines to be scanned* | ||
* '''[c s]''' - if -t is used, indicates how to do the sort | * '''[c s]''' - if -t is used, indicates how to do the sort | ||
− | * '''< | + | * '''<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) |
− | * '''< | + | * '''<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) |
− | * '''[ | + | * '''[alias]''' - optional alias called if -a is used |
* '''<matchtext>''' - the expression used for the search, if $null is used, it matches everything. | * '''<matchtext>''' - the expression used for the search, if $null is used, it matches everything. | ||
− | == | + | == Example == |
<syntaxhighlight lang="mIRC">;filter from the file "c:\my file.txt" to the custom window @mywin | <syntaxhighlight lang="mIRC">;filter from the file "c:\my file.txt" to the custom window @mywin | ||
/filter -fw "c:\my file.txt" @mywin *findthis* | /filter -fw "c:\my file.txt" @mywin *findthis* | ||
− | |||
;filter from the custom window @mywin to the file "c:\my file.txt" | ;filter from the custom window @mywin to the file "c:\my file.txt" | ||
filter -wf @mywin "c:\my file.txt" *findthat* | filter -wf @mywin "c:\my file.txt" *findthat* | ||
− | |||
;filter from the status window to the single message window | ;filter from the status window to the single message window | ||
/filter -sd *findthis* | /filter -sd *findthis* | ||
− | |||
;filter from the single message window to the status window | ;filter from the single message window to the status window | ||
/filter -ds *findthat* | /filter -ds *findthat* | ||
− | |||
;filter from the filename @this_is_a_file to the dialog 'dialog', id '1' | ;filter from the filename @this_is_a_file to the dialog 'dialog', id '1' | ||
/filter -fo @this_is_a_file dialog 1 *findthis* | /filter -fo @this_is_a_file dialog 1 *findthis* | ||
− | |||
;filter from a file and call an alias for each line | ;filter from a file and call an alias for each line | ||
/filter -fk file myalias *findthat* | /filter -fk file myalias *findthat* | ||
− | + | ;filter from a file to a file using regex | |
− | + | /filter -ffg file1 file2 /regex here/ | |
− | |||
− | |||
− | |||
− | |||
− | ;filter from a | ||
− | |||
− | |||
− | /filter - | ||
− | |||
− | |||
− | / | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 91: | Line 57: | ||
== See also == | == See also == | ||
+ | * [[List of commands - mIRC|List of commands]] | ||
+ | * [[List of identifiers - mIRC|List of identifiers]] | ||
* {{mIRC|$filtered}} | * {{mIRC|$filtered}} | ||
− | |||
− | |||
* {{mIRC|/loadbuf}} | * {{mIRC|/loadbuf}} | ||
* {{mIRC|/savebuf}} | * {{mIRC|/savebuf}} | ||
+ | {{mIRC command list}} | ||
+ | |||
+ | [[Category:mIRC commands|filter command - mIRC]] |