473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to convert txt file to HTML using shell?

19
Hello,

May I convert txt file to HTML using shell?

Thenks,
Feb 20 '08 #1
3 24812
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
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.