Forum Moderators: phranque

Message Too Old, No Replies

Parsing a text file in to HTML

Looking for direction to go....

         

travelin cat

9:20 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



We suddenly have a need to be able to parse a .txt file with tab-delimited content that will be uploaded to a server by a 3rd party and have it display as a table in html on an existing page.

I'm looking for any possible ideas that anyone may have.

Thanks in advance.

victor

6:44 am on Aug 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd fire up REBOL and tweak this code:


infile: %csv-file.txt
outfile: %html.txt
write outfile <table>
foreach line read/lines infile [
write/append outfile <tr>
foreach field parse/all line form tab [
write/append outfile rejoin ["" <td> field </td>]
]
]
write/append outfile </table>
halt

The results to upload are in html.txt

travelin cat

3:19 pm on Aug 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



victor, thank you for that... I will look in to it.

Another thing I forgot to mention is that the site is running on a large ISP's system, so we have somewhat limited access to their servers...