![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
|||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|