mIRC Home    About    Download    Register    News    Help

Print Thread
#164197 09/11/06 03:01 AM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
A switch for /filter to stop filtering whenever matching matchtext


Kind Regards, blink
#164198 10/11/06 02:18 AM
Joined: Apr 2005
Posts: 7
M
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Apr 2005
Posts: 7
That would be $read() or $fline()

Last edited by Msmo; 10/11/06 02:20 AM.
#164199 10/11/06 06:10 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
lol I was going to say that but i sumed he must have ment something more complexe as that seemed obvious.

#164200 10/11/06 06:32 AM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
It would be better if it was a built-in feature.

$fline if %line = %a break
$read if %a = $readn break

I always use /filter and I don't want to interupt it using loops.

smile


Kind Regards, blink
#164201 10/11/06 06:41 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I dont really see what your saying here honstly

however now you mention it, I seem to remember something about a change to allow mirc to abourt a filter operation that was being sent to an alias using -k, either it was int he watsnew file or mybe it was only a feature sggeston someone brought up? cant remember.

I think it was something like, wanting to be able to filter results but abort after collecting so many, which would be a lot faster than using $read or $fline. Fiberoptics name rings abell in connection to this, but don quot me on that either.

anyone able to lend a mention of this?

#164202 10/11/06 09:08 AM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
-k won't be that good because I don't want to start an alias neither.
only one /filter to do so.


Kind Regards, blink
#164203 10/11/06 03:14 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
/write -c outfile.txt $read(infile.txt,tw,*wild*string*,1)

-genius_at_work

#164204 10/11/06 08:34 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I think you are missing something in the nature of /filter. Its designed to pull ALL matching lines from the source. If you want to just find the first match then use $read or $fline as you have had suggested to you.

#164205 11/11/06 07:23 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Perhaps he wants /grep ? :>

While we're at it, how about /find and /sed and /awk, oh, and /perl ;P

Then we would be most of the way towards mIRCOS laugh


Sais
#164206 11/11/06 11:34 AM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Limiting /filter output can be brilliant when your sorting a file.

Much like SQL LIMIT sorting is done before LIMIT so therefor if you can limit /filter to get the 10 highest scoring nicknames you wont have to overhead of outputting the other 30.000, per example , to the output buffer.


$maybe
#164207 11/11/06 12:43 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
As I mentioned that could be done with -k switch. but if there is a way to call one filter with all those options

Hey Martin long time no see!


Kind Regards, blink
#164208 11/11/06 08:44 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
since the condition that is ment to invoke the stopping of the filter could be anything, i doubt you well ever see if applyable to the /filter command itself.

You might want to stop after 10 mathes, or after 10 times where the 3rd parameter on the matched line is "Blob", or where the 9th parameter has been the same for the last 5 matches.

I doubt you could get all of them onto a command line.

#164209 11/11/06 08:50 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Limiting /filter output can be brilliant when your sorting a file.

Much like SQL LIMIT sorting is done before LIMIT so therefor if you can limit /filter to get the 10 highest scoring nicknames you wont have to overhead of outputting the other 30.000, per example , to the output buffer.


Well so can filter be stopped? it wasnt /halt in the -k alias becuase that did nothing when i tested it. I havent needed to do this for some time, but i still keep thinking i saw something about Khaled saying he had updated something so a repeditively called alias could stop the calling command (this might have been to do with findfile honestly im not sure).

Currently if i have needed to i have used this approch
Code:
alias example { .enable #example.filter.alias.group | filter -fk temp.txt example.filter.alias * }
;
#example.filter.alias.group off
;
alias -l example.filter.alias { 
  if (..no_longer_filtering..) { .disable #example.filter.alias.group | return }
  ;
  ..take_what_ever_action..
  ;
}
;
#example.filter.alias.group end
;
alias -l example.filter.alias { }

Which while it cuts down the time taken as after not needing to filter its a simple empty alias, this method still incurs the over head in the initail command of looping the rest of the way through the source, which if its a say 2,000,000 line file can still take some time.

#164210 11/11/06 09:16 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
This could be a useful feature in some situations.

How about:

/filter -h#

-> Automatically stops filtering after the #th match.
-> Example: /filter -ffh3 infile.txt outfile.txt *


and also:

/filter -h
or
/stopfilter

-> Manually stop the calling /filter command. (Must be used in the -k alias)
-> Example: /filter -ffk infile.txt /outalias *
--> alias outalias { if (d isin $1-) filter -h

-genius_at_work

#164211 11/11/06 09:50 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
I have never attempted to halt it, i personally would use something like:
Code:
alias example { 
  if ($hget(filter,0).item) hfree filter
  hadd -m filter limit $1 
  filter -fk temp.txt example.filter.alias * 
}
alias -l example.filter.alias { 
  hinc -m filter climit
  if ($hget(filter,limit) <= $hget(filter,climit)) return
  /*
  ..take_what_ever_action..
  */
}


If you can specify this directly to the /limit command you don't have the overhead of calling an alias repeatingly nor the overhead of writing more to the output buffer then is needed, saving quite some time.

What i was trying to say is that sorting should have higher precedence then limiting. So that it wont sort the N limited matches but returns the N limited lines from the sorted input buffer.


$maybe
#164212 11/11/06 09:52 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Sup blink smile


$maybe
#164213 13/11/06 05:50 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
Fiberoptics name rings abell in connection to this, but don quot me on that either.

anyone able to lend a mention of this?


It was here


Gone.
#164214 13/11/06 06:59 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Quote:
Well so can filter be stopped? it wasnt /halt in the -k alias becuase that did nothing when i tested it. I havent needed to do this for some time, but i still keep thinking i saw something about Khaled saying he had updated something so a repeditively called alias could stop the calling command (this might have been to do with findfile honestly im not sure).

Yes, that was for $findfile(). However, /filter -k doesn't work like that; it goes through the entire infile, caches the results and then loops over those, calling the -k alias. Changing this in /filter would probably require major changes and create other problems. So what the OP wants (/filter not going through all lines in infile) is rather unlikely imo.

That said, a nice (and quite feasible) alternative would be /halt stopping the -k alias from going through all lines in the cache, which in many cases is the bottleneck (even if the alias simply /returns, /filter is much faster without -k).

Edit: Ok, seems the OP didn't want a /stopfilter, I must've mixed feature suggestions :tongue: I do remember it being mentioned recently but a quick search didn't find anything...

Last edited by qwerty; 14/11/06 03:35 PM.
#164215 14/11/06 03:14 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
I think a custom alias /stopfilter would be great.


Kind Regards, blink
#164216 14/11/06 09:38 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Edit: Ok, seems the OP didn't want a /stopfilter, I must've mixed feature suggestions :tongue: I do remember it being mentioned recently but a quick search didn't find anything...


LOL I thought thats exactly what he asked for. Oh well maybe he needs to explain a little more clearly (well at least for me)


Link Copied to Clipboard