You could just use /filter, and then /write -c to clear the file.
As an example: //filter -fk mymessages.txt myalias | write -c mymessages.txt
Or if you just want to test WITHOUT CLEARING THE FILE, try: /filter -fk mymessages.txt myalias
alias myalias {
;$1 contains the whole line.
echo -s Here's the whole line: $1
;This thing here splits the input line into tokens separated by character 32, which is a normal empty space.
tokenize 32 $1
echo -s There are $0 words! First word: $1 Second word: $2 Third word: $3 $+ ...
}
/help /filter
/help /write