The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to forward mail in /var/mail/username to external mail unitipon SUN Solaris 2 05-27-2008 01:20 AM
Typical way to disable a dameon XP_2600 SUN Solaris 2 11-29-2006 03:56 AM
Mail Script need Help??? gkrishnag UNIX for Dummies Questions & Answers 2 09-26-2006 01:32 AM
I need a script that script extract info from mail meravd Shell Programming and Scripting 1 10-19-2004 12:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-02-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 95
typical mail script

hi i have a requirement to write a mail script which needs to be automated.There are 7 CSV files generated for 7 clients in a single day.Each file will contain one header and the name of the file follows a nomenclature like ABC_20080402_ClientID.csv.ClientID is lets say AJAT,THUJH,RTYUJ,TJJIGF,HTUKG,HUJGD,THYIUJ for 7 files and 20080402 is the rundate.If the file contains more than one record then it should appear in the mail along with its record count.
The path of the files are /data.
The mail should appear in the following format
The subject line should be : files generated for 02-Apr-2008
_____________________________________________
Hi All
The files are generated for the date 02-Apr-2008 successfully.
Following are the details:
File Name : ABC_20080402_AJAT.csv
Rec Count:200
File Name : ABC_20080402_THUJH.csv
Rec Count:1000
<Record counts should be picked from the file system>
There are zero records for the clients TYUJ,TJJIGF,HTUKG,HUJGD and THYIUJ.<This line should not appear if the no. of records in all the files are more than 1>

Regards,
Team

______________________________________________

Please help me in writing the script.It would be better if the file names appear in the bold font.Can we use HTML in writing the shell script so that mail will look good??

Waiting for reply
  #2 (permalink)  
Old 04-02-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 95
please help me out in writing the mail script.i need it urgently
  #3 (permalink)  
Old 04-03-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink Here is a start


Code:
rm msg.log
for zf in *.csv; do
   echo "The file is ""$zf" >>msg.log
   count=$(wc -l "$zf")
   echo "# recs = ""$count" >>msg.log
done

mailx -s "April 2 files" john@abc.com <msg.log

  #4 (permalink)  
Old 04-04-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 95
there are some other points i have mentioned there like if number of recs=1 then the client id will be notified with a sentence.how can i achieve.it would be better if you can give the script for that also
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0