read last 10 lines from txt - 07/05/05 02:19 PM
hello...
need a script thats read the last 10 lines from a txt-file
thx Bodo
need a script thats read the last 10 lines from a txt-file
thx Bodo
alias read { var %x = $calc($lines(file.txt) - 9) var %lines = $lines(file.txt) while (%x <= %lines) { echo -a $read(file.txt,%x) inc %x } }
alias read { var %lines = $lines(file.txt) var %x = $calc($lines(file.txt) - 9) while (%x <= %lines) { if (*nico* iswm $read(file.txt,%x)) echo -a $v2 inc %x } }
On *:Text:!trigger *:#: { var %lines = $lines(file.txt) var %x = $calc($lines(file.txt) - 9) while (%x <= %lines) { if ($+(*,$2,*) iswm $read(file.txt,%x)) msg $chan $v2 inc %x } }
alias last10 { var %lines = $lines(filename), %i while (%i <= 10) { if (nico isin $read(filename,%lines) { msg $active $read(filename,%lines) | inc %i } dec %lines }
alias last10 { var %lines = $lines(filename), %i while (%i <= 10) { if (nico isin $read(filename,%lines) { msg $active $read(filename,%lines) | inc %i } dec %lines } [color:red]}[/color]
alias l10 { var %filename = $sfile($logdir*.txt) filter -ffc %filename tmp *nico* window @read loadbuf 10 -p @read tmp .remove tmp } alias last10 { var %filename = $sfile($logdir*.txt) filter -ffc %filename tmp *nico* var %lines = $lines(tmp) echo -a . %lines var %10line = $calc(%lines - 10) while (%10line <= %lines) { if ($read(tmp,%10line)) { msg $active $read(tmp,%10line) } inc %10line } .remove tmp }
alias last10.2 { var %filename = $sfile($logdir*.log) filter -ffc %filename tmp.txt *nico* var %lines = $lines(tmp.txt) echo -a . %lines var %10line = $calc(%lines - 10) .play -f $+ %10line tmp.txt .timerlast10 1 12 .remove tmp.txt }
alias readfile { var %file = $sfile($logdir*.log) var %parm = $$?="Enter word(s) to find" .fopen logs %file echo -a $fopen(logs).fname echo -a errors: $ferr :findnext .fseek -w logs $+(*, %parm ,*) if ($ferr > 0) { goto end } if ($feof > 0) { goto end } elseif ($ferr <= 0) { echo -a $fread(logs) | goto findnext } :end fclose logs }