RE: awk question

  • From: Srinivasan Vasan <Vasan.Srinivasan@xxxxxxxxxxxxx>
  • To: "'oracle-l@xxxxxxxxxxxxx'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 9 Jun 2004 09:41:38 +0100

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@xxxxxxxxxxx] 
Sent: 09 June 2004 04:55
To: oracle-l@xxxxxxxxxxxxx
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



----- Original Message ----- 
From: "David Green" <thump@xxxxxxxxxxxxxxxx>
To: <oracle-l@xxxxxxxxxxxxx>
Sent: Tuesday, June 08, 2004 6:11 PM
Subject: awk question


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: