typical mail script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting typical mail script
# 1  
Old 04-02-2008
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  
Old 04-02-2008
please help me out in writing the mail script.i need it urgently
# 3  
Old 04-03-2008
Hammer & Screwdriver 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  
Old 04-04-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to compile a software for a non-typical platform?

I am quite new to compiling source codes in linux and have been running into a lot of problems in trying to do so since the platform configuration is different from most. For starters, I know that you need to enter the following commands in order to install any software manually in linux:... (2 Replies)
Discussion started by: Ice_Drake1
2 Replies

2. Shell Programming and Scripting

Typical problem in UNIX

Input file I have a file with four fields. f1,f2,f3,f4 A,1,10,00,S B,2,20,00,00,D C,3,100,00,00,G I want Output like f1|f2|f3|f4 A|1|10,00|S B|2|20,00,00|D C|3|100,00,00|G please help on this (4 Replies)
Discussion started by: bharat1211
4 Replies

3. Emergency UNIX and Linux Support

Calculating total space in GB for all files with typical pattern

Hi Experts, In a particular dir, I have many files *AJAY*. How can I get total size of all such files. I tried du -hs *AJAY* but it gave me individual size of all files. All I require is summation of all. Thanks, Ajay (4 Replies)
Discussion started by: ajaypatil_am
4 Replies

4. Shell Programming and Scripting

Guidance needed for a typical shell script with sql query

Hi , I have a txt file with contents like: 1234 2345 3456 7891 I need to write a script which takes input file as txt file..run a sql query for that number and place the output of query in another file.. select * from bus_event where acct_nbr='1234'( from input txt file) the query... (20 Replies)
Discussion started by: Rajesh Putnala
20 Replies

5. Shell Programming and Scripting

A typical array script

Hi All, I need to store the output of "find ." to an array one by one. Output of find . in my case will look like :- . ./one ./one/a ./one/b ./one/c ./two So my first array element should be "/one" and second one "/one/a" (need to remove "." from the output as well). Then I need to... (11 Replies)
Discussion started by: Renjesh
11 Replies

6. UNIX for Dummies Questions & Answers

Meaning and typical use of -3 signal in kill

Hi, What is the use of the signal -3 in kill command in unix? I read the meaning and typical use of this signal in one of the Oreilly books as below. Quit -- stop running (and dump core). Sent when you type CTRL-\. what does the CTRL-\ command do? Is it the combination of CTRL and... (6 Replies)
Discussion started by: venkatesht
6 Replies

7. Shell Programming and Scripting

script to read mail on a mail server

Hi All, Is there any way Unix shell script can directly read a mail on a mail server (for eg. abc@xyz.com) and save it as a text file in a unix directory ? Thanks PRKS ---------- Post updated at 08:37 AM ---------- Previous update was at 08:36 AM ---------- I am using ksh (1 Reply)
Discussion started by: PRKS
1 Replies

8. Solaris

Typical way to disable a dameon

I want to disable some services starting automatically while system booting, for instance if i want to disable vold what i have to do ? i think some services related to a script init level shell directory,and i think as well that since solaris 10 they added a command to enable and disable services... (2 Replies)
Discussion started by: XP_2600
2 Replies
Login or Register to Ask a Question