Sponsored Content
Full Discussion: Using mail in awk
Top Forums Shell Programming and Scripting Using mail in awk Post 302339114 by Shinsuio on Wednesday 29th of July 2009 07:43:05 PM
Old 07-29-2009
Using mail in awk

I'm having a bit of trouble using the mail command within awk. I'm sending the contents of the body through a pipe like so:
Code:
wget -qO- http://cs.actx.edu/~craddock/unix2/lab11 | awk -v oldprice=`cat pricefile` '
    /<b class="price">/ {
    print "The old price is: " oldprice
    getline
    retrievedprice = substr($0,2)
    print "The retrieved price is: " retrievedprice

    if (retrievedprice ~ oldprice) {
        print "The price is the same"
    }
    else{
        print "The price is not the same"
        print "Old price: $" oldprice "\n New price: $" retrievedprice | "mail -s "The Price Has Changed" username"
        print retrievedprice > "pricefile"
    }
}'

but when I attempt to run the shellscript, It does not appear to see the subject and assumes the username is the subject, so it asks for the recipients. Is it possible to use mail like this? When I use mail without a subject line it works fine.
 

10 More Discussions You Might Find Interesting

1. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

2. Shell Programming and Scripting

Mail from awk

Hi, I need to write a single line command which will check whether input variable is 0 or 1. if it is 0 then it should send a mail without attachment else it should send mail with attachment. I have to write in single line command. is there any way in awk? Please help me.. Any help on... (0 Replies)
Discussion started by: smr_rashmy
0 Replies

3. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

4. Linux

awk filter & Auto gen Mail

hi experts 2012-01-30 10:30:01:812 "y" "NA" "30/01/2012 10:30:01:154 AM" 2012-01-30 10:33:46:342 "y" "NA" "30/01/2012 10:33:45:752 AM" 2012-01-30 10:41:11:148 "n" "200" "30/01/2012 10:41:10:558 AM" 2012-01-30 10:44:48:049 "y" "NA" ... (7 Replies)
Discussion started by: nith_anandan
7 Replies

5. Shell Programming and Scripting

awk search file then pipe to mail

I need to write a script to search a static file (file1) in the form Name Email tim tfxo@gmail.com bob bob@sss.com and then mail them another file (file2) that is input from the command line. The command line would be: script.awk who file2 subject and the result would be mail -s subject who... (2 Replies)
Discussion started by: tfxobrien
2 Replies

6. Shell Programming and Scripting

Checking postfix mail log with AWK

Hello, Few days ago I found a person checking his mail log by AWK. But unfortunately I forget to take the command from him. Today I got to need that command badly. Here is a reference. When I check from my mail log like this it will not show me the details. grep "from=<noreply@panix.com>"... (2 Replies)
Discussion started by: rinti
2 Replies

7. Shell Programming and Scripting

Awk: from two file create a mail with attached error

Hi. My name is Mirko I have two file. File 1: mio@mio.it tst@test.com bye@bye.fr File 2: error 08 ffff mio@mio.it test error 05 ffff bye@bye.fr test error 11 ffff tst@test.com test error 65 ffff mio@mio.it test error 55 ffff bye@bye.fr test Examples I would like to send a mail... (2 Replies)
Discussion started by: Gionfalco01
2 Replies

8. Shell Programming and Scripting

awk command with if & mail

Hi Experts, I want to check in table that if third column value is "bhu" & if it is greater than 500 it will send mail other wise there will be no mail. but as per my script mails are still coming even value is below 500 with one blank mail(without any content) with subject line"test mail". I... (12 Replies)
Discussion started by: dravi_laxmi
12 Replies

9. Shell Programming and Scripting

UNIX/Linux - awk - displaying unxpected ! character when viewed in mail; but not in actual file

Greetings Experts, I am on AIX using ksh; I am processing the input files and generating a awk_output.txt file using AWK. By reading that awk_output.txt file, I am building a output.html file which is cat and then fed to /usr/sbin/sendmail .When the shell script is triggered through command... (2 Replies)
Discussion started by: chill3chee
2 Replies

10. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies
Finance::Quote::Trustnet(3pm)				User Contributed Perl Documentation			     Finance::Quote::Trustnet(3pm)

NAME
Finance::Quote::Trustnet - Obtain unit trust prices from trustnet.co.uk SYNOPSIS
use Finance::Quote; $q = Finance::Quote->new; %stockinfo = $q->fetch("uk_unit_trusts","trust-name"); # Can failover to other methods %stockinfo = $q->fetch("trustnet","trust-name"); # Use this module only. DESCRIPTION
This module obtains information about UK unit trust prices from www.trustnet.co.uk. The information source "uk_unit_trusts" can be used if the source of prices is irrelevant, and "trustnet" if you specifically want to use trustnet.co.uk. UNIT TRUST NAMES
Unfortunately there is no unique identifier for unit trust names. Therefore enough of the name should be given including spaces to yield a unique match. Trustnet sometimes uses abbreviated names, and the string given should match the abbreviation. Consult http://www.trustnet.co.uk/ut/funds/perf.asp?sort=0 to find a match for your unit trusts. Example "jupiter income" LABELS RETURNED
Information available from Trustnet may include the following labels: exchange method source name currency bid ask yield price. In case of a unit trust, "price" returns the offer (ask) price. In case of an OIEC, the unique price is returned in "bid", "ask" and "price". SEE ALSO
Trustnet website - http://www.trustnet.co.uk/ Finance::Quote::Yahoo::USA perl v5.14.2 2012-05-06 Finance::Quote::Trustnet(3pm)
All times are GMT -4. The time now is 08:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy