473,815 Members | 3,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to convert txt file to HTML using shell?

19 New Member
Hello,

May I convert txt file to HTML using shell?

Thenks,
Feb 20 '08 #1
3 25170
WinblowsME
58 New Member
Expand|Select|Wrap|Line Numbers
  1. #! /bin/bash
  2.  
  3. echo "<html>" > test.html
  4. cat test.txt >> test.html
  5. echo "</html>" >> test.html
Feb 20 '08 #2
quartz
19 New Member
I tried but not get what I wont. I have txt file:
name city phone
David Wiena 33333
Sofi Paris 88888
etc

I wont to convert it to html file with no any changed?

When I tried what u told me I get:
name, city phone, david .... as hml file.

Thenks
Feb 21 '08 #3
WinblowsME
58 New Member
Expand|Select|Wrap|Line Numbers
  1. #! /bin/bash
  2.  
  3. if [ $# -eq 0 ] ; then
  4.    echo "USAGE: $(basename $0) file1 file2 file3 ..."
  5.    exit 1
  6. fi
  7.  
  8. for file in $* ; do
  9.    html=$(echo $file | sed 's/\.txt$/\.html/i')
  10.  
  11.    echo "<html>" > $html
  12.    echo "   <body>" >> $html
  13.  
  14.    while read line ; do
  15.       echo "$line<br>" >> $html
  16.    done < $file
  17.  
  18.    echo "   </body>" >> $html
  19.    echo "</html>" >> $html
  20. done
Feb 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3412
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only happening when I put my XML files and the .xsl files on my ISP's system for my home page. If I try to open the XML files in Netscape 7.0 on my own machine (ie, not on the ISP's system), the pages convert file and the result is displayed in HTML.
4
7052
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right? However, even if it is technically feasible, it can take long time to do the conversion, especially the HTML is complicated. Is there any other more efficient way? Thanks!
0
1223
by: Mike Wasilewski | last post by:
I am trying to get file information using COM but I do not get all of the info using the code below. $shell = new COM("Shell.Application") or die("COM Shell Application Problem."); $myfolder= $shell->Namespace(0); $fileinfo= $myfolder->ParseName("C:\\test.wma"); for ($i=0; $i<33; $i++) { echo $i.") ".$myfolder->GetDetailsOf("",$i).": ".$myfolder->GetDetailsOf($fileinfo,$i)."<br>";
1
1329
by: Alan T | last post by:
I want to convert file type another such as convert from HTML to .txt convert from Excel to .txt convert from Word to .txt convert from PPT to .txt so that I can run it programmatically in my code. Any ways or any .exe of this utility can do this conversion?
1
2690
LeoTD
by: LeoTD | last post by:
Dear all, I want to convert file type .doc to .html in Linux. But I can't be get it, please show me How to coding for convert it ? Thanks a lot.
1
3007
ilikesuresh
by: ilikesuresh | last post by:
Hi, My requirement is to view the certain file from unix shell(korn). What i did is $SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service exec emp_history(); commit; . . .
4
7698
by: yogarajan | last post by:
hi am develop my project about my pdf file file convert to html file (That html file looks like pdf (same text style and alignment)) pls anyone give suggestion pls give some idea am waiting for ur reply
9
3522
by: madhu3437 | last post by:
help ,please using shell script i want know the all process are running or not in a particular path. the result will shown in web page (html). process name = running ( server is running) process name1 = not running( here server is not running) process name 2 = running ( server is running)
1
1909
by: new one | last post by:
i want to convert a html file to dom using python
0
9736
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10672
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10145
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9226
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3888
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.