Visit Our UNIX and Linux User Community


Format the output to sent in Email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Format the output to sent in Email
# 1  
Old 11-21-2011
Format the output to sent in Email

Hi

I have a script

Code:
#!/bin/sh


# email addresses to send results to, separated by a space
EMAILS="xxxx.yyyy@yahoo.com"

SUBJECT="MySQL reporting "
DISK_DATA_USAGE=/home/aaaa/usaage.txt
mysql YYYYYYYY -e " select 100*sum(max_data_length) as disk_usage_pct from xxxxxx;" > /home/aaaa/usaage.txt

mysql ndbinfo -e "select node_id, memory_type, 100*used memory_usage_pct from xxxxx >> /home/aaaa/usaage.txt

mysql ndbinfo -e "SELECT node_id, 100*(page_requests_wait_io) as hit_ratio_pct FROM XXXX;" >> /home/aaaa/usaage.txt

/bin/mailx -s "$SUBJECT" "$EMAILS" < $DISK_DATA_USAGE

/bin/rm/$DISK_DATA_USAGE


the output in the email is not formatted correctly

Code:
 disk_usage_pct
  162.5000
  node_id          memory_type            memory_usage_pct
  4          Data memory            96.4871
  4          Index memory            88.4126
  6          Data memory            96.6160
  6          Index memory            88.3879
  node_id          hit_ratio_pct
  4          97.9363
  6          98.0097

how do I correct the format of the output.

Last edited by pludi; 11-21-2011 at 05:12 AM.. Reason: need to add more information
# 2  
Old 11-21-2011
Code:
 
mysql --help

MySQL :: MySQL 5.0 Reference Manual :: 4.5.1.1 mysql Options

Are you looking for the -t option ?
# 3  
Old 11-21-2011
THe output in usaage.txt is in tabular format but when email is send than the format changes.
how do I change my code so that the format read from the usaage.txt is in tabular format when a email is sent.

thanks

Previous Thread | Next Thread
Test Your Knowledge in Computers #301
Difficulty: Easy
Slackware was originally derived from the Software Linux System (SLS).
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX command output format in email is not same as on the system

Hi I have script to collect file system usage statistics from few remote unix hosts and email . On the UNIX system the column spacing is fine but the email output is not aligned properly. Any tips to fix this ? (1 Reply)
Discussion started by: new2prog
1 Replies

2. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

3. Shell Programming and Scripting

Email Format Output issues

Hi Guys, I have written a script, which output information from email notfication. The output works fine in HTML format, but non-html format it is not shown in a human readable format. Can you help with the format *** Script echo " Server Name : $CLIENT_CHECK "... (4 Replies)
Discussion started by: Junes
4 Replies

4. Shell Programming and Scripting

EMAIL Format in UNIX

Hi , Need help of Email Format I have TEST .txt file which contains below data /home/a.DAT File Not received /home/a.CTL File Not received /home/b.DAT File Not received /home/b.CTL File Not received i am using below command to send mail mail -s "ERROR: files" $MAIL_LIST <... (6 Replies)
Discussion started by: satish1222
6 Replies

5. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

6. Shell Programming and Scripting

Check Date Format And Email Out

Hello All, I have a requirement where i need to get the EXTRACT_DATE from a file and check if the date is of valid format or not and then mail it if it is not valid. Appreciate if you can help me with this. I did the following so far. awk '{for(i=1;i++<=NF;)if($i~/^EXTRACT_DATE/) print $i}'... (11 Replies)
Discussion started by: Ariean
11 Replies

7. Shell Programming and Scripting

Using AWK to format output and email

Hello, I'm a bit stumped, for some reason when using AWK 'print' is not printing the entire date/line. awk '{print "Ticket #: " $1} {print "Queue : " $2} {print "Recieved : " $3} {print "AP Date : " $4} {print "Circuit ID : " $5} {print... (4 Replies)
Discussion started by: ArvinSodhi
4 Replies

8. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

9. UNIX for Dummies Questions & Answers

Format data before i email it to the User

Hi, i have a report which I basically need to format before i email it to the User. it comrises of data in below format currently YOMP_CSC_ASSESS_SCY062 cancelled SOMO_Ckswed_ACEAMT_PC3 completed SOMO_sdasf_TAX_ASSET completed SOMP_CSC_ndksljfh_SCY060 cancelled I need it in the below... (2 Replies)
Discussion started by: rohit.shetty84
2 Replies

10. Shell Programming and Scripting

Format disorder after email with attachment

Hello My script is to email a textfile(abc) in unix. I open abc.txt using window notepad. All the "Enter Key"(line break) are found missed. However, it is no problem using window wordpad. uuencode abc abc.txt | mailx -s "Email Subject" someone@email.com How can I adjust the above command... (1 Reply)
Discussion started by: on9west
1 Replies

Featured Tech Videos