Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: awk question
AWK takes variables as parameters, as follows, which can then be referred to
inside the awk script:
awk -v var=value ....
Cheers,
Vasan.
-----Original Message-----
From: Darrell Landrum [mailto:darrell_at_landrum.com]
Sent: 09 June 2004 04:55
To: oracle-l_at_freelists.org
Subject: Re: awk question
Here is an example of one idea, although there may be a cleaner way.
I've used an ls -l command to get a particular file size instead of the
orastat in your code, then compare that to a previously defined threshold.
Basically, I take the threshold and the ls result and concat them into one
variable with a space in between.
Then, send that value into your awk statement for the test of $1 to $2.
hp19:/home/dlandrum $ cat ak
export WARNING_THRESHHOLD=10
export TBS_WARNING=`ls -l test.ksh| awk '{print $5}'`
export CHK_TBS_WARNING="$TBS_WARNING $WARNING_THRESHHOLD"
echo $CHK_TBS_WARNING | awk '{if ($1 > $2) print $1}'
hp19:/home/dlandrum $ ksh -x ak
+ export WARNING_THRESHHOLD=10
+ awk {print $5}
+ ls -l test.ksh
+ export TBS_WARNING=21
+ export CHK_TBS_WARNING=21 10
+ echo 21 10
+ awk {if ($1 > $2) print $1}
21
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ___________________________________________________________________________ This email and any attached to it are confidential and intended only for the individual or entity to which it is addressed. If you are not the intended recipient, please let us know by telephoning or emailing the sender. You should also delete the email and any attachment from your systems and should not copy the email or any attachment or disclose their content to any other person or entity. The views expressed here are not necessarily those of Churchill Insurance Group plc or its affiliates or subsidiaries. Thank you. Churchill Insurance Group plc. Company Registration Number - 2280426. England. Registered Office: Churchill Court, Westmoreland Road, Bromley, Kent BR1 1DP. ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Wed Jun 09 2004 - 03:38:27 CDT
![]() |
![]() |