mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 87
T
Tat Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 87
Okay, so I came to this point where after using series of filter commands and a regex to get the lines matching a specific criteria, I realized it moved duplicate lines that matched. Now I need to remove the duplicate lines.

My current plan is to make another custom window, aline each and every line to the other window with the -n tag. Then filter them all back to the original window. Or sort them with a filter and kill ever and run a reverse loop killing any matching lines.

Shouldn't there be a filter tag to not add duplicate lines? I've written the same code before and removing duplicates would be way easier. With such a flag.

/filter -wwq @mywindow @mywindow *
(assume q tag add line already in window to same window)

That would be some nice code for killing duplicates. And not adding them in the first place.

The non-dup flag -n exists for aline and iline. But, I'm such a pro at filter I almost never aline anything more than one line.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
alias aline.-n.@window2 { aline -n @window2 $$1- }
//filter -wk @window1 aline.-n.@window2 *
;
The alais can be called anything really
;
alias blah { aline -n @window2 $$1- }
//filter -wk @window1 blah *


Watch out that u cant add the -c switch as it wont clear @window2 and i wouldnt like to play with using the same window for input and output (might work tho)

[edit]
Umm sorry i thiought Id mentioned that as well, that I did think it was a real good idea, just gave them above as a method to do it now.

Last edited by DaveC; 06/02/05 04:44 AM.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If your window1 contents come from a file or another window, you might as well issue a filter there immediately, making a second window obsolete.

Suppose it's coming from a file, you'd do

window -h @@
filter -fkg myfile.txt myalias <regex pattern>
alias myalias aline -n @@ $$1

Nevertheless, I think it's a good suggestion, and I would like to see it added, especially when working on large files, where you'll get less overhead if this anti-duplicate routine is coded internally.


Gone.
Joined: Jan 2003
Posts: 87
T
Tat Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Jan 2003
Posts: 87
DaveC's suggestion for it is great though. Gotta remember that one for other such commands. Still takes a different start and end location though.

Yeah, internal commands are leaps and bounds faster. I swear any script that can't move data with filter is a *huge* waste of time.


Link Copied to Clipboard