If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > replace variable value in mail content as in file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-05-06, 02:34
pooja pooja is offline
Registered User
 
Join Date: Dec 2002
Posts: 104
replace variable value in mail content as in file

hi,

i have a mail content file like
--- mail.txt ----
hello,

please do the following action in $days days. Visit $site_add ......

thx
-----

now i want to send a mail to 100 user from a script
script
-------
days=7
site_add=http://www.dummysite.com

mailx -s "test" abc@xyz.com < mail.txt

--------

Desired output in mail
-----------------------
hello,

please do the following action in 7 days. Visit http://www.dummysite.com......

thx
----------------

can you please help me here,

thanx alot in advance.
--Pooja
Reply With Quote
  #2 (permalink)  
Old 05-05-06, 09:31
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
You'll have to substitute it yourself
sed 's!$days!'$days'!g;s!$site_add!'$site_add'!g' mail.txt | mailx -s "test" abc@xyz.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On