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 

data file

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
ranny
Halfop


Joined: 22 Jun 2005
Posts: 49
Location: switzerland

PostPosted: Fri Aug 05, 2005 12:42 am    Post subject: data file Reply with quote

Hello,

I have a file.txt with data and i don't know how to write the data who start with letter "G" (for example). I know open and read the file.

Thx for help
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Aug 05, 2005 1:22 am    Post subject: Reply with quote

you need to learn at least the basics of Tcl before asking for help with a script; from your question I gather that you don't know a thing about string manipulation (or else you wouldn't be asking how to filter data which starts with a particular letter), so please get back to your Tcl book or/and tcl.tk and learn about [string]
Back to top
View user's profile Send private message Visit poster's website
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Fri Aug 05, 2005 10:15 am    Post subject: Reply with quote

when you've done what demond said, here's a quick tutorial on how to write to a file.
Back to top
View user's profile Send private message Send e-mail
ranny
Halfop


Joined: 22 Jun 2005
Posts: 49
Location: switzerland

PostPosted: Thu Aug 11, 2005 5:02 am    Post subject: Reply with quote

hello,

i have
Code:
[string equal -length [string length $del] $x $del ]

and
Code:
[regexp -all -inline {<td class="row2" align="center"><span class="gensmall">(.+)</span></td>} $body]

it's ok.
but it's possible to make simpler??
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 11, 2005 1:36 pm    Post subject: Reply with quote

see FAQ forum, "Parsing webpages made easy"
Back to top
View user's profile Send private message Visit poster's website
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Thu Aug 11, 2005 3:24 pm    Post subject: Reply with quote

"easy" being a relative term Wink
Back to top
View user's profile Send private message Send e-mail
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 11, 2005 10:53 pm    Post subject: Reply with quote

well yeah hehehe... if you need to parse for just a single or couple of data elements, using tDOM/XPath doesn't make much sense and would be an overkill; however, if you have to implement complex parsing logic and there's good chance for that webpage to change, it would be much easier to go with tDOM and simply adjust XPath as necessary
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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