mIRC Home    About    Download    Register    News    Help

Print Thread
J
Jesper
Jesper
J
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

S
ScatMan
ScatMan
S
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.
J
Jesper
Jesper
J
uuh Scatman, "readnews 1" reads 2 lines, "readnews 2" reads 3 lines.. etc etc frown

S
ScatMan
ScatMan
S
i'd edited my command, check the new one

J
Jesper
Jesper
J
Many thanks smile


Link Copied to Clipboard