| View previous topic :: View next topic |
| Author |
Message |
skgsergio Voice
Joined: 10 Oct 2010 Posts: 2
|
Posted: Sun Oct 10, 2010 8:02 pm Post subject: How to manage a simple database (text file) |
|
|
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 |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Oct 10, 2010 9:19 pm Post subject: Re: How to manage a simple database (text file) |
|
|
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.  |
|
| Back to top |
|
 |
skgsergio Voice
Joined: 10 Oct 2010 Posts: 2
|
Posted: Mon Oct 11, 2010 5:54 am Post subject: |
|
|
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 |
|
 |
|