| View previous topic :: View next topic |
| Author |
Message |
ranny Halfop
Joined: 22 Jun 2005 Posts: 49 Location: switzerland
|
Posted: Fri Aug 05, 2005 12:42 am Post subject: data file |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Aug 05, 2005 1:22 am Post subject: |
|
|
| 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 |
|
 |
greenbear Owner
Joined: 24 Sep 2001 Posts: 733 Location: Norway
|
Posted: Fri Aug 05, 2005 10:15 am Post subject: |
|
|
| when you've done what demond said, here's a quick tutorial on how to write to a file. |
|
| Back to top |
|
 |
ranny Halfop
Joined: 22 Jun 2005 Posts: 49 Location: switzerland
|
Posted: Thu Aug 11, 2005 5:02 am Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 11, 2005 1:36 pm Post subject: |
|
|
| see FAQ forum, "Parsing webpages made easy" |
|
| Back to top |
|
 |
greenbear Owner
Joined: 24 Sep 2001 Posts: 733 Location: Norway
|
Posted: Thu Aug 11, 2005 3:24 pm Post subject: |
|
|
"easy" being a relative term  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 11, 2005 10:53 pm Post subject: |
|
|
| 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 |
|
 |
|