LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2012, 12:51 AM   #1
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Rep: Reputation: Disabled
Automatic email-with Subject line containing the previous date


Hi,
Below is the Query i use to get Automatic mail from unix

nohup bteq <pn_store_info_2011.bteq> store_transaction.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas store_transaction.sas
wait

/*zip SAC_Tire SAC_Tire.xls*/
(cat store-message.txt; uuencode Store_Level_Trans.xls Store_Level_Tran.xls) | mailx -s "Store Level Transaction Report" -r "Automotive " `cat mailpcp_Store.dat`

my query is - the subject line should be like "Store Level Transaction Report-April 04/2012" that is i will be running the code daily and my subjcet should contain yesterday date.

2. also my attachment also should have the yesterday date.
i Tried few option but not working.
Any help would be Great.pls..
pls. help
 
Old 04-06-2012, 01:01 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
date -d yesterday gives yesterday's date. It can be formatted as required using the +FORMAT argument.
 
Old 04-06-2012, 01:07 AM   #3
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
(cat store-message.txt; uuencode Store_Level_Trans.xls Store_Level_Tran.xls) | mailx -s "Store Level Transaction Report"date -d yesterday -r "Automotive " `cat mailpcp_Store.dat`

I tried the above one- but i didnt recieve the mail.also my Attachment Store_Level_Trans.xls should be Store_Level_Trans_Yesterday.xls ..

New to coding- so pls. help
 
Old 04-09-2012, 01:10 AM   #4
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
Any help on the above said issue..
 
Old 04-10-2012, 02:51 AM   #5
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
got what i needed-
-----------------
yest=$(TZ=EST24EDT date '+%x')
yest1=$(TZ=EST24EDT date '+%Y%m%d')
mv Store_Level_Trans.xls Store_Level_Trans_$yest1.xls

(cat store-message.txt; uuencode Store_Level_Trans_$yest1.xls Store_Level_Trans_$yest1.xls && uuencode Query_Used.txt Query_Used.txt) | mailx -s "Store Level Transaction Report on $yest " -r "Automotive " `cat mailpcp_Store.dat`
-----------------------------
Worked !!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl script to replace a line after finding a previous line Mark1986 Programming 1 02-28-2011 06:09 PM
how can i move to previous system date using command line karan_bagaria Linux - Newbie 5 09-22-2010 05:01 PM
HowTO Insert Counter # in subject line before sending email message keopp Linux - Server 5 02-26-2010 03:33 AM
Attempting to append a line of text to the end of the previous line market_garden Linux - General 4 12-11-2008 12:37 PM
Automatic saving of emails by time and subject captainpotato Linux - Software 0 04-05-2005 03:21 AM


All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration