Converting text file to html

I have a plain text file that looks like this -

234234 some text

345435 some text

23423 some text

I would like to convert this to HTML either by vbscript, perl or something else so that it looks nice when emailed out. That is maybe I can make the numbers Bolded etc.

Any ideas on how i can do this?

thanks

Answers


If your file is as simple as you have written, something like perl -ne 'chomp; s!^(\d+)!<b>$1</b>!; print "$_<br />\n"' inputfile.txt will do what you have asked.

However if your source is any more complex than this, look into one of the many html formatting modules on CPAN


You can use some template processing system such as Template::Toolkit. For example: create a template for the email and store it in a perl variable or file. Then process the template providing some values to be filled in.


Need Your Help

get current working directory in Lua

windows-xp lua getcwd

What's the Lua to get the current working directory on Windows XP SP3 (or to get the directory of the currently-running Lua file)? I prefer not to use LuaFileSystem.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.