LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Convert text files to html files (https://www.linuxquestions.org/questions/linux-software-2/convert-text-files-to-html-files-367648/)

lothario 09-27-2005 08:15 PM

Convert text files to html files
 
I have a bunch of plain text files.
Need to convert them into corresponding HTML pages.

Is there some command that I can use (in a shell script) to convert:

abc.txt to abc.html
def.txt to def.html
:::
xyz.txt to xyz.html


I would like to preserve the line breaks, paragraphs, punctuation, etc.

dmellem 09-27-2005 08:29 PM

Well, there's txt2html (http://txt2html.sourceforge.net/) which uses the Perl module HTML::TextToHTML....

-Dan

lothario 09-27-2005 08:39 PM

This looks good but it is not installed on this host:

which txt2html

/usr/bin/which: no txt2html in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin)

dmellem 09-27-2005 08:48 PM

Try

perl -e 'use HTML::TextToHTML;'

and see if you get an error. If you do, you'll need to use CPAN or some other method to get the module.

Just download the tarball with:

untar it and follow the README. There's nothing to compile and it can run in your home directory.

-Dan


All times are GMT -5. The time now is 05:13 AM.