Need help with shell scripting...

Hi Guys,

I wrote a shell script. I want you guys to look at it and can give ur suggestions of how i can make it better. I am a starter and so needed ur help and assistance.

Help Appreciated.

Example Script:
$ORACLE_HOME/bin/sqlplus -s apps/apps@$ORACLE_SID <<EOF

set echo off
set feedback off
set timing on
set termout off
set hea off
col FN format a45
set linesize 200
set pagesize 0

spool /usr/tmp/list.log
select outfile_name FN
from fnd_conc_requests_form_v
where program = 'AutoInvoice Print'
and argument1 = 'CUSTOMER'
and argument2 = 'INV'
and request_id = 4471022
and completion_text = 'Normal completion';
spool off

set timing off

cd /usr/tmp
cat list.log | while read line
out_file=`echo $line | awk '{print $1}'`
cd /
lp -d PHSACT12 `echo $out_file`
rm list.log

Guys, I had one more question.

I am getting some data in to the list.log file, which is:

old   7: and trunc(request_date) = to_date('&1','MM/DD/YYYY')
new   7: and trunc(request_date) = to_date('03/23/2006','MM/DD/YYYY')
Elapsed: 00:00:07.95

I am trying to extract the third line and print that file to the printer using lp -d printername filename

But what my problem is, its fetching every line and excuting it. First two lines and the fourth line also executes and displays " no such file or directory exists".

How can i supress them and take only the third line which is file showing the complete path where that file is stored.

Help Appreciated

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

out_file=`head -3 list.log | tail -1`
lp -d PHSACT12 $out_file

In sqlplus command section code:

set ver off
set timing off

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.