Table format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Table format
# 1  
Old 04-02-2012
Table format

Code:
My Code

Hi Friends,

I need to get output in table format using unix shell script.For example my server CPU and memory utilization report will come as a mail with ordinary format but i want to make as table format.

Here two output finally we are getting:-

CPU utilization is $toatal_CPU_Utilized
Memory utilization is $toatal_Memory_Utilized

But i want in table format.Help me any way to get?

Thanks,
Susi/SSmilie
# 2  
Old 04-02-2012
your output file should be in the below format.
Code:
 
 
<html>
<body>
<table border=1>
<tr><td>CPU Utilization</td><td>$total_CPU_Utilized</td></tr>
<tr><td>Memory Utilization</td><td>$total_Memory_Utilized</td></tr>
</table>
</body>
</html>

After that you can send the above html file with sendmail utitlity. ( search in this forum for sendmail )
# 3  
Old 04-02-2012
your attachment file (sendm.html) maybe like below
Code:
<TABLE border="1" cellpadding="3" cellspacing="0" width="500">
<tr>
<td width="25%" align="center" bgcolor="red">
<font face="verdana" color="purple">Host Name</font>
</td>
<td width="25%" align="center" bgcolor="yellow">
<font face="verdana" color="purple">Total CPU Utilization</font>
</td>
<td width="25%" align="center" bgcolor="yellow">
<font face="verdana" color="purple">Total Memory Utilization</font>
</td>
</tr>
<tr>
<td width="35%" align="center">
<font face="verdana" color="purple">myhostname</font>
</td>
<td width="%30" align="center">
<font face="verdana" color="purple">CPU_UT</font>
</td>
<td width="35%" align="center">
<font face="verdana" color="purple">MEMORY_UT</font>
</td>
</TABLE>

add the code to your script and replace the variables from script
Code:
sed "
s/myhostname/$(hostname)/
s/CPU_UT/$CPU_FROM_YOUR_SCRIPT/
s/MEM_UT/$MEMORY_FROM_SCRIPT/
" sendm.html > tempm.html && mv -f tempm.html sendm.html

Code:
uuencode sendm.html sendm.html |mail -s "REPORTS" yourmail@foodomain.com

regards
ygemici
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell output format like table

Hi, OS: Redhat 7.5 shell: Bash Wrote below script to login into oracle via shell script and trying to reset locked account..It works as expected. But I need specific output << EOF should go to target terminal not all out put running below script from ansible command line.. #!/bin/bash... (1 Reply)
Discussion started by: onenessboy
1 Replies

2. Shell Programming and Scripting

Need the output in the mentioned Table format

Hi Friends, I have the script output like below: Script Output: ----------------------------------------------------------------------- Details of the Client: ----------------------- name: server1; save set: All; ... (3 Replies)
Discussion started by: akmani
3 Replies

3. Shell Programming and Scripting

Output in table format

I have one script which generate file called report.txt having following output parameter_name status comment banking ok NA finance 30% hike NA Loan_department ok 20% HR_Group defaulters Ajay I wanted to convert this file into tabular form. You can see each line contain 3 words and... (7 Replies)
Discussion started by: Nakul_sh
7 Replies

4. Programming

Arrange word in table metrix format

Hello everyone, I have some problem about this code : #!/usr/bin/env python import sys try : filename = sys.argv except : print 'Specify filename' sys.exit() fd = open(filename) lines = fd.xreadlines() compare = {} for line in lines : split_line =... (1 Reply)
Discussion started by: awil
1 Replies

5. Shell Programming and Scripting

Normal text to table format

Hi, I am trying to show my list, from a simple list format to a table (row and column formatted table) Currently i have this format in my output (the formart it will always be like this ) >> first 3 lines must be on the same line aligned, and the next 3 shud be on 2nd line....: INT1:... (10 Replies)
Discussion started by: eboye
10 Replies

6. Shell Programming and Scripting

convert the output in table format

Hi All, I have a output like below values val1=test.com val2=10.26.208.11 val3=en1 val4=test-priv1.com val5=192.168.3.4 val6=en2 val7=test-priv2.com val8=192.168.4.4 val9=en3 val10=test-vip.com val11=10.26.208.9 val12=$val3 I want to convet this output values into below... (1 Reply)
Discussion started by: kamauv234
1 Replies

7. Shell Programming and Scripting

Converting form field to table format

May data Name = Andi Address = none Phone = 82728 Name = Peter Address = none Phone = 98799 The expected output Name,Address,Phone Andi,none,82728 Peter,none,98799 what i have done (6 Replies)
Discussion started by: before4
6 Replies

8. Programming

Create table with date format.

Hello, Could you please let me know the correct format of CREATE TABLE statement with DATE format. CREATE TABLE EMP_TABLE1 ( NAME VARCHAR(6) PRIMARY KEY, ADDRESS VARCHAR(6), BIRTH_DATE DATE ); I want BIRTH_DATE to be in "YYYYMMDDHHMISS" format. How we can create table with... (4 Replies)
Discussion started by: Poonamol
4 Replies

9. Programming

Creating a table like format with rows and columns

I have few files which have two columns in each. like e2 1 1 2694 2 4 2485 3 2 2098 5 1 2079 6 5 2022 9 4 1734 11 5 1585 13 2 1461 18 1 1092 21 2 1019 24 1 915 25 3 907 27 1 891 28 3 890 34 1 748 39 1 700 (1 Reply)
Discussion started by: kamuju
1 Replies

10. Shell Programming and Scripting

Format txt file as html table

I have a short time to solve a problem, so I need some help. I've searched the forum, but I couldn't find a solution to my problem. I made a script to filter some text and now I have a new requirement to make it available as html table. Problem is that I more than one files with different set... (2 Replies)
Discussion started by: tetreb
2 Replies
Login or Register to Ask a Question