| View previous topic :: View next topic |
| Author |
Message |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Thu Nov 01, 2007 9:45 am Post subject: Questions and more questions. |
|
|
Hi there,
I wanna ask is -exact of lsearch case sensitive? If it is, what option should I choose not to have the case sensitivity. Thank you.
I also got question regarding the file operation. If I wanted to update the file with the data from variable call "$data" which is a list. What should I do if I want to skip the first few line of the file from been overwrite. Thank you.
Regards,
Lu5ck |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Thu Nov 01, 2007 10:05 am Post subject: Re: Questions and more questions. |
|
|
If you have questions about particular commands, check the manual. There's no -nocase option in the latest stable release, so your best bet is to do a case insensitive regexp match | Code: | | lsearch -regexp $list {(?i)yourword} | or convert everything to lower-/uppercase before doing the search. _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Nov 01, 2007 10:07 am Post subject: |
|
|
It is case sensitive, and unfortunately, there is no documented option to make it non-case sensitive.
Make sure you open the file in append-mode, such that it is not truncated and the write pointer is at the end of the file. Ex:
| Code: | | set fid [open "myfile" "WRONLY CREAT APPEND"] |
See the manual page for open other options. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Mon Nov 05, 2007 10:01 am Post subject: |
|
|
Hi there,
Thanks. I want to ask about "bind time * <function>" as well. If I indicate it as *, how often will the function be run?
Regards,
Lu5ck |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Nov 05, 2007 10:04 am Post subject: |
|
|
Once every minute _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Mon Nov 05, 2007 10:08 am Post subject: |
|
|
Hi there,
Thanks.
Regard,
Lu5ck |
|
| Back to top |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Sat Nov 10, 2007 9:00 am Post subject: String map |
|
|
Hi there,
I got question about "string map" command. I don't know how it work, the documentation is confusing for me. I assume that you can have many replacement in string map right? But I still kinda confused.
Regards,
Lu5ck |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Nov 10, 2007 11:16 am Post subject: |
|
|
It can indeed handle multiple replacements at once.
In order to achieve this, create a list with odd numbered elements being the key to look for, and even elements being what to replace it with. Order is of importance in some cases, as string map will scan the list and stop at the first match (ai needs to come before a, otherwize a will always make the match).
A simple example of a "map":
| Code: | set map [list "oldword1" "newword1" "oldword2" "oldword2" ...]
set map [list "aibo" "cool dog" "ai" "artificial intelligence" "a" "the letter a"] |
You could also build this map using arrays and "array get", however, keep in mind that the order is not fixed when using "array get".
| Code: | set mymap(oldword1) "newword1"
set mymap(oldword2) "newword2"
set map [array get mymap]
|
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|