egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to manage a simple database (text file)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
skgsergio
Voice


Joined: 10 Oct 2010
Posts: 2

PostPosted: Sun Oct 10, 2010 8:02 pm    Post subject: How to manage a simple database (text file) Reply with quote

I'm trying to do a simple database with this schema using text file:

Code:
Nick1 Number Number
Nick2 Number Number
Nick3 Number Number
...


How to use data is simple and how to search or insert a new line is easy.

But I don't know how to do things like modify an entry (or delete but I don't need delete for my script).

Anyone can help me?
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Oct 10, 2010 9:19 pm    Post subject: Re: How to manage a simple database (text file) Reply with quote

Just thinking about it ( I haven't experimented and tried it) ... could you read your text file into a list?
( http://forum.egghelp.org/viewtopic.php?t=6885 )

Then, manipulate the list... searching, replacing, etc.
( ex: http://www.tcl.tk/man/tcl8.5/TclCmd/lreplace.htm
and
http://www.tcl.tk/man/tcl8.5/TclCmd/lsearch.htm )

When done, write the list back to text file, overwriting the original file.

Is that viable?


p.s. There is a high probability that I've read about doing it this way, somewhere in the past. Most likely, that would be this forum. In other words, it might be a good idea to try some searches here... you might find it described in more detail. Smile
Back to top
View user's profile Send private message
skgsergio
Voice


Joined: 10 Oct 2010
Posts: 2

PostPosted: Mon Oct 11, 2010 5:54 am    Post subject: Reply with quote

I read and saw some scripts using it but I didn't know if it's a good way but I will test it.
About searching... well I searched by "text file database" an didn't found that post.

Thx for all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber