awk pass $LOGDIR parameter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk pass $LOGDIR parameter
# 1  
Old 08-11-2010
awk pass $LOGDIR parameter

hi guys

i need your help , i wrote one script which is as below

Code:
#!/bin/ksh
###########################################################
LOGDIR=/export/home/xyz/logs
EMAILFile=$LOGDIR/xxs_email.log
BOX=$(uname -a | awk '{print $2}')

awk '{if ($4 >= 30) {print $1 " " $3 " HAS LAG of " $4 " min -- at --  " d "\n" > "$LOGDIR/xxs_email.log" } e
lse {print "NO LAG FOUND for " $3" " d > "`$EMAILFile`" } }' "d=$(date)" $LOGDIR/xxs_2.log

its gives me error when i try to put $LOGDIR/xxs_email.log


how to put $LOGDIR in this awk command
any idea guys...

thanks in advance ....

Last edited by pludi; 08-11-2010 at 02:20 AM.. Reason: code tags, please...
# 2  
Old 08-11-2010
Try...
Code:
awk '{if ($4 >= 30) 
             print $1 " " $3 " HAS LAG of " $4 " min -- at --  " d "\n"
      else   print "NO LAG FOUND for " $3 " " d
     }' d="$(date)" $LOGDIR/xxs_2.log > $LOGDIR/xxs_email.log

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Unable to pass shell script parameter value to awk command in side the same script

Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies

2. Shell Programming and Scripting

Pass parameter

Hi, I have following for loop , please let me know how to get ${TXP_EXT_TABLE_${i}_SQL} parameter with 1DAY and 7DAY values. for i in 1DAY 7DAY do ${NZSQL_DIR}/nzsql -h ${HOST} -time -v ON_ERROR_STOP=1 -f ${SQL_DIR}/${TXP_EXT_TABLE_${i}_SQL} > ${TMP_LOG_FILE} 2>&1 done ... (4 Replies)
Discussion started by: sandy162
4 Replies

3. Shell Programming and Scripting

Pass value from file to parameter

Hi Guys, I have a file in the format Parmater=value. I want to read the value and pass it to corresponding Variable. The Parameter file is as follows Number=23 Text1=mango Text2=yup 'Number' value needs to be read and passed to ID variable. Also, 'Text1' value needs to be passed to... (9 Replies)
Discussion started by: mac4rfree
9 Replies

4. UNIX for Dummies Questions & Answers

How to pass the parameter value to a... ?

Hello I have a simple code like this one: #!/bin/ksh VER=$1 cat /usr/text | while read line do echo $line done Let's say $1=1.0.0 and the contents of text is: abcd.cfg asdf I would like the output to be like this abcd1.0.0.cfg asdf1.0.0 I am thinking of passing the... (5 Replies)
Discussion started by: khestoi
5 Replies

5. Shell Programming and Scripting

Pass input and output file as parameter to awk script

Hi, i am new to awk. I am using csv2pipe script(shown below) BEGIN { FS=SUBSEP; OFS="|" } { result = setcsv($0, ",") print } # setcsv(str, sep) - parse CSV (MS specification) input # str, the string to be parsed. (Most likely $0.) # sep, the separator between the values. # #... (6 Replies)
Discussion started by: bhaskarjha178
6 Replies

6. Shell Programming and Scripting

How to pass a parameter

Hi all, How to pass a parameter from a oracle pl/sql procedure parameter to shell environment and use it? (1 Reply)
Discussion started by: megh
1 Replies

7. Shell Programming and Scripting

Pass parameter into script

I would like to write a scirpt a.sh that it first checks the first parameter of the input. If it fulfill some condition ,then run an executable program b by using all the parameter. ie. > ./a.sh 10 20 30 40 50 Then a.sh first checks the first parameter, 10, if it mathes the requirement, then... (2 Replies)
Discussion started by: alfredo
2 Replies

8. Shell Programming and Scripting

How to pass one parameter from one column to another column in AWK

I am having scenario where input file is containing text like below ----------------------------------- Name,x.y.z.i.j.k,p.q.r.s.t.k,y.d.f.u.g.h,e.r.t.yu.t.u,...... Place,Bangalore,hyderabad,Chennai,Delhi,............ I need to read and put it in file in a column structure ... (1 Reply)
Discussion started by: prasanta jena
1 Replies

9. UNIX for Dummies Questions & Answers

PASS parameter to AWK

Hi, Can i pass a parameter(not a file name) as a parameter to a awk program? eg; $awk -f test 1 2 3 here test is the filename...and 1,2,3 are the i/p parameters? thank you:-) (2 Replies)
Discussion started by: unisam
2 Replies
Login or Register to Ask a Question