| View previous topic :: View next topic |
| Author |
Message |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Wed Dec 21, 2005 9:54 am Post subject: Read file help.. |
|
|
| Code: | package require http
bind pub - !read foo
proc foo {n u h c t} {
set x [::http::geturl www.website.com/file.txt]
foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
::http::cleanup $x
} |
It is code to read file from website, i`ve seen it on this forum, but I want to read only 4 latest lines, any ideas?? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Dec 21, 2005 10:48 am Post subject: |
|
|
Try
| Code: | | [lrange [split [::http::data $x] \n] 0 3] |
instead of
| Code: | | [split [::http::data $x] \n] |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Wed Dec 21, 2005 4:00 pm Post subject: |
|
|
| thx |
|
| Back to top |
|
 |
|