mIRC Home    About    Download    Register    News    Help

Print Thread
#44010 25/08/03 05:29 AM
Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
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,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
/write -dl $+ %rlinenr filename.txt

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


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Joined: Aug 2003
Posts: 136
Vogon poet
Offline
Vogon poet
Joined: Aug 2003
Posts: 136
I'd use collectives his is better


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That doesn't work, please test your code before posting it.

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


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
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.

Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
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.

Joined: Apr 2003
Posts: 17
S
sorex Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Apr 2003
Posts: 17
works great guys smile


Link Copied to Clipboard