mIRC Home    About    Download    Register    News    Help

Print Thread
#66849 06/01/04 09:31 PM
Joined: Dec 2002
Posts: 111
E
Vogon poet
OP Offline
Vogon poet
E
Joined: Dec 2002
Posts: 111
I am writing a quick alias that is going to go through a large list of proxies and gline them all, however, proxy lists usually come in this format:

###.###.###.###:Port

I need to remove the : and replace it with a space so that i can just read it in, use $1 to get just the IP, and then ban the IP.

How do i do that?

I tried this but it didnt work:
Note: i am only at the replacing stage
Code:
alias banproxy {
  set %testfor $read(proxy.txt, 1)
  if (: isin %testfor) {
    echo : is present, I am going to assume that that is the seperator for the port and remove anything after it.
    set %lines $lines(proxy.txt)
    set %count 1
    set %line $read(proxy.txt, %count)
    set %toban1 $replace(%line, :,  )
    echo %toban1

  }
}


if i use $remove, it removes the : but doesnt leave a space =/

any ideas?

I also tried using " " to put a space but that didnt work either.

thanks for your help!

#66850 06/01/04 09:32 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I haven't tested your code, but this will replace a : with a space:
$replace(%line,:,$chr(32))

#66851 06/01/04 09:34 PM
Joined: Dec 2002
Posts: 111
E
Vogon poet
OP Offline
Vogon poet
E
Joined: Dec 2002
Posts: 111
ahhh sweet, works. Thanks!

#66852 06/01/04 09:37 PM
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
why not just use $gettok(###.###.###.###:Port,1,58)
where 58 is $chr(58) == :


If it ain't broken, don't fix it!

Link Copied to Clipboard