LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2015, 11:27 PM   #1
aristosv
Member
 
Registered: Dec 2014
Posts: 125

Rep: Reputation: Disabled
convert txt to 3 column html


I have a server sending me a plain text email every day, reporting the below parameters. Its reading them from a text file, and sending them to my email.

How can convert this to a three column html table and send that?

Code:
Sync Total: 1 directory, 4 files, 0 symlinks
---------------------------------
Host Name: host name here
---------------------------------
Group Name: group name here
---------------------------------
Disk Usage: 37%
---------------------------------
CPU Usage: 78%
---------------------------------
Memory Usage: 11%
---------------------------------
Temperature: 44.9'C
---------------------------------
Local IP: 192.168.0.115
---------------------------------
Public IP: public ip here
---------------------------------
Tunnel Port: 5001
---------------------------------
Tunnel Status:
Fri Mar 6 06:23:00 EET 2015 opening reverse tunnel from my_host_here:5001 to 127.0.0.1:22
---------------------------------
Thanks
 
Old 03-05-2015, 11:49 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
What would be the column criterias(name)?

Did you tried any scripts yourself? If so post it.
 
Old 03-06-2015, 12:23 AM   #3
vinay9
LQ Newbie
 
Registered: Mar 2015
Posts: 1

Rep: Reputation: Disabled
#a.html is output_html_file
#file.txt is the text file produced by server
oldIFS=$IFS
IFS=:
terminal=`tty`
exec<file.txt
echo "<html><head><title>forecast</title></head><body><table border=5>" >>a.html
while read line
do
set $line
echo "<tr><td>"$1"</td><td>"$2"</td></tr>" >>a.html
done
echo "</table></body></html>" >>a.html
IFS=$oldIFS
exec<$terminal
 
Old 03-06-2015, 12:51 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,250

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Please use [code][/code] tags to display code or data.

So what is your issue?
 
Old 03-06-2015, 12:56 AM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
From that file can you show an example of first row (arrangement).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I use Shell script to edit row 23 column 5-8 in a txt file? leena_d Linux - Newbie 4 12-14-2009 04:43 AM
from html to txt/doc gawain Linux - Software 6 02-06-2007 02:58 AM
Convert pdf to html or txt or remaster the pdf? jago25_98 Linux - Software 1 12-13-2005 02:11 AM
how to convert text(html) back to html. d1l2w3 Linux - Software 4 04-08-2005 09:16 PM
Convert Powerpoint files to txt,html..... devinWhalen Linux - Software 0 07-29-2003 01:12 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration