mIRC – Scripting examples 1 filter to sort

To use these you must have a copy of mIRC installed.

This blog assumes you know how to run mIRC a windows application and have some knowledge of scripting.

Using /filter to sort is a common use case, so here are a few examples, these are very fast. Filter has an option to create a custom sorting alias but many times it may be slower and not needed. You can enter these commands into any window in mIRC usually status window. Make a file called blah.txt and on a few separate lines write a few words, you can make this easy and use the command below, write your words in then save and close.

//write -c blah.txt | run blah.txt

On to some command line examples.

;  1. In mIRC type /help /filter to get a full reference of -switches

;  Sort lines of text in a text file, blah.txt is our example text file

/filter -ffct 1 32 blah.txt bleh.txt

;  -ff means input is a file and output is also a file
; -c just clears the output file bleh.txt in case it has other stuff, plus creates if doesn't exist.
; -t sorts based on columns and a separator 1 32 = column 1 separator is chr 32 aka a space
; basically the first word/character to the left of first space is the sort item

; 2. Sort lines of a .ini file where = is separator and 2nd column is the sorted item, basically 2 means the word after = character, chr 61
; This may look tricky because in a .ini file format file each line is prefixed with an item name like n0=myword, the command is sorting all lines of this .ini based on myword
; Is this even useful? I have used it a couple of times, but generally a text file sort is more useful. Tip even a .txt file can be in .ini format.

/filter -ffct 2 61 bleh.ini huh.txt 

; 3. What are the 'chr 61' and 'chr 32' stuff? Quick way to find the 'chr' number for characters in mIRC
; /help $asc 
; Enter the following line into any window of mIRC, we use two // to evaluate aka process the identifier $asc(=)

//echo -a $asc(=)


Leave a Comment