simple awk

when I execute this awk stmt ..

awk "/log_directory/ { print $5}" /opt/dba/oraadmin/tools/tmp_purge_op.log

it's returning the whole line as ..

IRMD118_LISTENER1 parameter "log_directory" set to /opt/oracle/10.2/network/log/

my expected output is : /opt/oracle/10.2/network/log

what I am missing here ?

Thanks

try this:

awk '/log_directory/ { print $6}' /opt/dba/oraadmin/tools/tmp_purge_op.log

sorry, I missed what you wanted on the expected output, try this:

awk '/log_directory/ { print substr($6,1,length($6)-1) }' /opt/dba/oraadmin/tools/tmp_purge_op.log

This will take off the last "/"

awk '{ print $NF }'

Thankyou all for your input.
I inserted the code in perl and I am still not getting what I wanted..

DB<2> c
main::(./purge_listener_log.pl:93):

93: $log_dir=`cat $ENV{TOOLS}/tmp_purge_op.log | grep log_directory | awk '{ print $NF }'`;

DB<2> s
main::(./purge_listener_log.pl:94):
94: $log_file_name=`cat $ENV{TOOLS}/tmp_purge_op.log | grep log_file | awk '{ print $NF }'`;

DB<2> p $log_dir
IRMD118_LISTENER1 parameter "log_directory" set to /opt/oracle/10.2/network/log/

DB<3>

Thanks

You don't need the cat and grep command, take them out and assign $log_file_name with the awk command.

I tried with that option too and still getting the same results ..

you need to post your code, looking at a line of code when variables are assigned does not help your cause.