mIRC Home    About    Download    Register    News    Help

Print Thread
removing a line from a text file #62642
02/12/03 07:50 PM
02/12/03 07:50 PM
Joined: Oct 2003
Posts: 9
Chicago, IL, USA
C
CWO Offline OP
Nutrimatic drinks dispenser
CWO  Offline OP
Nutrimatic drinks dispenser
C

Joined: Oct 2003
Posts: 9
Chicago, IL, USA
I'm kinda new to the $read and /write commands and I'm trying to find a way to remove a variable line number. Basically I have the /write command write your *!*@host or known as $address($nick,2) to a text file. Now I have

if $read(masks.txt, w, $address($nick,2)) == $address($nick,2) {

in this part of my file I want it to now delete the matching entry. I know $readn returns the line number but I cant seem to get it to be useful in the /write command. The only thing I got it to delete so far was the first line no matter what it is.
So far I have tried
/write -dl$readn masks.txt
/write -dw$readn masks.txt
/write -ds$address($nick,2) masks.txt

I know there has to be a way to get this to work. I also have tried the same after setting a variable to $readn and the variable is being set to the right line number, just not working in /write. I just dont want to have to make it

If ($readn == 1) {
/write -dl1 masks.txt
}
If ($readn ==2) {
/write -dl2 masks.txt
}

and so on... since theres going to be a whole ton of lines in this text file.

Re: removing a line from a text file #62643
02/12/03 09:59 PM
02/12/03 09:59 PM
Joined: Feb 2003
Posts: 282
S
saragani Offline
Fjord artisan
saragani  Offline
Fjord artisan
S

Joined: Feb 2003
Posts: 282
How about:
/write -dl $+ $readn masks.txt

If you write -dl$readn, I won't work, cause mIRC doesn't recognize the $readn


When you write -dl$readn, mIRC doesn't know what you want, and $readn in this cause will be Null, so you actualy wrote

/write -dl masks.txt

Note: You can't write anothing at the left side of a $something (It will cause it to not recognize the $something), but you CAN write $somethingsomethingelse . For example:

If $readn was 3 then
//echo -a $readn.hello
will return 3.hello

and
//echo -s hello.$readn
Will return hello.

Re: removing a line from a text file #62644
02/12/03 10:23 PM
02/12/03 10:23 PM
Joined: Oct 2003
Posts: 9
Chicago, IL, USA
C
CWO Offline OP
Nutrimatic drinks dispenser
CWO  Offline OP
Nutrimatic drinks dispenser
C

Joined: Oct 2003
Posts: 9
Chicago, IL, USA
Thanks that worked. Didnt think you can space it out like that without it taking the number as the file name smile cool grin