Confused with redirection

Hi Guys,

First of all I am not entirely sure if this is the correct way of doing what I need to be done. I have tried to google for some suggestions and so far it got me more confused.

Basically what I need is to pipe the output of a program to a function in KSH and inside the function some processing should happen. Something like the one below.

write_multiline_log()
{
cat <&0 | while read line
do
some processing here...
log_info "processed text here"
done
}

sqlplus -s user/password@blah @query.sql | write_multiline_log

I know it looks somewhat stupid but what I am trying to accomplish is to capture the output of a program and put it into a log file in a coherent format (with timestamp and all)

Thank you in advance for your help.

Warm regards.

---------- Post updated at 01:05 PM ---------- Previous update was at 12:42 PM ----------

never mind got it to work here at home. gonna try again at the office tomorrow.

Do you want to listen for input to separate process for input?