mIRC Home    About    Download    Register    News    Help

Print Thread
#44010 25/08/03 05:29 AM
S
sorex
sorex
S
hello,

how would delete a line in a text file based on a variable that hold the line number to be deleted?

/write -dl%rlinenr filename.txt

doesn't seem to work

Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
/write -dl $+ %rlinenr filename.txt

Joined: Aug 2003
Posts: 136
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 136
/write -d%d filename.txt
assuming you set the variable to %d

Joined: Aug 2003
Posts: 136
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 136
I'd use collectives his is better

Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
That doesn't work, please test your code before posting it.

Joined: Aug 2003
Posts: 136
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 136
It is tested it currently works in my mirc under my scripts

Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
Code:
alias wrong {
  write test.txt a
  write test.txt b
  write test.txt c
  set %d 2
  write -d%d test.txt
  run test.txt
}

Will give you:
a
b

which is wrong, it should give you:
a
c

which mine does. Yours always deletes the last line, that isn't what he wants.

S
sorex
sorex
S
sorry for the late response but I forgot my password which I needed to enter on this machine that didn't have the cookie yet.

anyway thanks for the replies, I'll try them out when I'm at home.

btw, didn't even know about that $+ thingy but according to the mIRC help that should do the trick.

S
sorex
sorex
S
works great guys smile


Link Copied to Clipboard