mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 96
J
Jesper Offline OP
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
How do I make $read read the last lines of a txt file?
like. I know how to get the last, but how to get the last 10 or 5 for that matter?


I need it in a alias event that echos the results to me.
eg.

alias readnews
;usage /readnews (number of lines to read but max 10)
echo -a .... this is where you can help me smile

Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
two ways
first u can use loadbuf: /loadbuf NUMBER-OF-LINES WINDOW file.txt
and the second:
alias readnews {
if ($1 <= 10) {
var %i = $calc($lines(file.txt) - $1 +1)
while (%i <= $lines(file.txt)) {
echo -a $read(file.txt,%i)
inc %i
}
}
}

Last edited by ScatMan; 12/05/03 11:51 AM.
Joined: Jan 2003
Posts: 96
J
Jesper Offline OP
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
uuh Scatman, "readnews 1" reads 2 lines, "readnews 2" reads 3 lines.. etc etc frown

Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
i'd edited my command, check the new one

Joined: Jan 2003
Posts: 96
J
Jesper Offline OP
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
Many thanks smile


Link Copied to Clipboard