Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

From tabbed text to HTML splitting the lines

by gok8000 (Scribe)
on Aug 12, 2008 at 17:24 UTC ( #703936=CUFP: print w/ replies, xml ) Need Help??

Hi Monks,

I thought somebody might be interested in mine http://dataoniphone.sourceforge.net/

It is in Perl (it's quite simple but it works).

gok8000

Here it is a sample. But please look into Sourceforge if you really want to use it. Greetings!

#!/usr/bin/perl # # http://sourceforge.net/projects/dataoniphone/ V 0.9 04/08/2008 17:02 +:00 # open (INFILEHANDLE, "<table.txt") or die "error opening"; open (OUTFILEHANDLE, ">table.html") or die "error opening"; while (<INFILEHANDLE>) { chomp; if ($_ eq "") { print OUTFILEHANDLE "<B><\/B><BR>\n\n<HR>\n"; # was an empty line } else { s/\t/ /; #join 1st & 2nd field (comment this if undesired) s/\t/ <\/B><BR>\n/; # 1st fields will be bold so we have a <\/B> s/\t/ <BR>\n/g; # remaining fields will end with <BR> print OUTFILEHANDLE "<B> $_ <BR>\n<HR>\n"; # record separator will + be <HR> } } close INFILEHANDLE; close OUTFILEHANDLE; print "\nFile table.html created (press a key)\n"; $line = <STDIN>;

Comment on From tabbed text to HTML splitting the lines
Download Code
Re: From tabbed text to HTML splitting the lines
by toolic (Chancellor) on Aug 12, 2008 at 17:35 UTC
Re: From tabbed text to html splitting the lines
by jettero (Monsignor) on Aug 12, 2008 at 18:22 UTC
    Just in case anyone would like to see it and safe the 4,000 clicks through sourceforge, and unpacking the zip file... update: this made more sense before it was reparented from a dup-node that did not have the sources in it.
    #!c:/Perl/bin/Perl.exe # # this code was put in the public domain here: # http://sourceforge.net/projects/dataoniphone/ V 0.9.0 04/08/2008 17: +01:00 open (INFILEHANDLE, "<table.txt") or die "error opening"; open (OUTFILEHANDLE, ">table.html") or die "error opening"; while (<INFILEHANDLE>) { chomp; if ($_ eq "") { print OUTFILEHANDLE "<B><\/B><BR>\n\n<HR>\n"; # was an empty lin +e } else { s/\t/ /; #join 1st & 2nd field (comment this if undesired) s/\t/ <\/B><BR>\n/; # 1st fields will be bold so we have a <\/ +B> s/\t/ <BR>\n/g; # remaining fields will end with <BR> print OUTFILEHANDLE "<B> $_ <BR>\n<HR>\n"; # record separator wi +ll be <HR> } } close INFILEHANDLE; close OUTFILEHANDLE; print "\nFile table.html created (press a key)\n"; $line = <STDIN>;

    -Paul

Re: From tabbed text to HTML splitting the lines
by omouse (Initiate) on Sep 02, 2008 at 06:16 UTC
    There *is* a CSV module that you can use. Why not use that instead of replacing tabs? http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm
      Because my data source was tabbed text. Thank you very much for the link anyway :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://703936]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-09-20 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (159 votes), past polls