Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    104

    Unanswered: 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

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •