This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

search line

Old posts that have not been replied to for several years.
Locked
k
kozpt
Voice
Posts: 1
Joined: Wed Feb 02, 2005 8:51 pm

search line

Post by kozpt »

___________________________________________________________
bind pubm - "*teste*" pubm:teste
proc pubm:teste { nick uhost handle channel arg } {
global bla
set file logs/ipc.log
set textf [open $file r]
set data [read $textf]
foreach line [split $data \n] {
if {[string match *word* $line]} {
set text $line
putserv "PRIVMSG $chan :I found word in line $text"
}
}
catch {close $file}
}
___________________________________________________________________

whats wrong in this code?? i want that eggdrop searchs for a word in a logfile and say the lines of the file he found the word
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Re: HELP ME, file related

Post by ^DooM^ »

kozpt wrote:if {[string match *word* $line]} {
How does it know what *word* is?

that should be the argument passed in ($arg).
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Either check Basic File Operations or user's post.
Once the game is over, the king and the pawn go back in the same box.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

And 'close $file' simply should be okay. I don't find a need to use "catch" in this case.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked