473,465 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Create 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 24834
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
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...
4
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?...
0
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=...
1
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...
1
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
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
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...
9
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)...
1
by: new one | last post by:
i want to convert a html file to dom using python
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.