Correct format in a log file

I'm trying to read the output of a .sql script (simple insert and commit oracle pl/slq script) to a log file using a shell script. My problem is I end up with a log file that looks like this:

sd12@phenix97:/detain/sd12/logs > cat 20071205_detain_20071206.log
12320496 rows created. Commit complete. 14439654 rows created. Commit complete. 8307988 rows created. 0 rows created. Commit complete. 0 rows created. Commit complete. 0 rows created. Commit complete. 62 rows created. Commit complete. 5013 rows created. Commit complete. 15997 rows created. Commit complete. 173 rows created. Commit complete. 0 rows created. Commit complete. 2 rows created. Commit complete. 9076 rows created. Commit complete. 716 rows created. Commit complete.

How do i get it to start a new line after Commit Complete. Is there a way I can have it do this by modifying my .sh script.

Thanks in Advance.

can you show use some of the shell script??

often you cxan get a new line to start by using \n

eg:

echo "first line\nsecond line"

how about awk?

awk -F'.' ' { print $0  "." } ' oraclelogfile

This is the .sh script:

#!/bin/sh
LFPD=`TZ=CST date +%Y%m%d` #PROCESS_DATE
LFFD=`TZ=CST+24 date +%Y%m%d` #FOR_DATE
LFN="${LFFD}_detain_${LFPD}"
LFP=/:/detain/sd12/logs
LF=$LFP/$LFN.log
VALUE=`sqlplus -s sd12@phenix97/sd12 @detain.sql`
if [ -z "$VALUE" ]; then
echo "No Rows Copied"
exit 0
else
echo $VALUE >> $LF #LOG_FILE
fi
exit 0

so, the log file reads the output from 'detain.sql' which is:

sd12@phenix97:/detain/sd12/logs > cat detain.sql | more
insert into schema.table1 (select * from schema.table1@DF_DBLINK.WORLD where for_date = to_date(trunc((sysdate)-1)));

commit;

insert into schema.table2 (select * from schema.table2@DF_DBLINK.WORLD where for_date = to_date(trunc((sysdate)-1)));

commit;
.
.
.
.
insert into schema.tablen (select * from schema.tablen@DF_DBLINK.WORLD where for_date = to_date(trunc((sysdate)-1)));

commit;

exit

Does the /n (new line) go in b/w each insert statement? I rem'ber trying that & it didn't work. Is there a way I can include something in the .sh to make $VALUE format in the way I orig. wanted? Please Advice

echo "$VALUE\n" >> $LF #LOG_FILE

This def. works. Thanks rob. I still need to get rid of the blank lines in between:

0 rows created.

Commit complete.

1164988 rows created.

Commit complete.

8320999 rows created.

Commit complete.

1494097 rows created.

Commit complete.

Any ideas?

echo "$VALUE" >> $LF #LOG_FILE

remvoing the extra newline character changes the doubly spaced output to single-spaced.

sed '/^[<spc><tab>]*$/d'

will remove all empty lines (that is: lines with no characters and lines consisting only of whitespace). Replace "<spc>" and "<tab>" with literal space/tab characters.

bakunin

Thanks to you both. I have come this far:

echo "$VALUE" | sed '/^[ ]*$/d' >> $LF #LOG_FILE

Gives:

0 rows created.
Commit complete.
1164988 rows created.
Commit complete.
8320999 rows created.
Commit complete.
1494097 rows created.
Commit complete.

Is there anyway I can make Commit Complete to also stay in the first line, like this.....

0 rows created. Commit complete.
1164988 rows created. Commit complete.
8320999 rows created. Commit complete.
1494097 rows created. Commit complete.

Thanks in Advance.

echo "$VALUE" | sed '/^[ ]*$/d | sed 'N;s/\n/ /'

The complete command would be...

echo "$VALUE" | sed '/^[ ]*$/d | sed 'N;s/\n/ /' >> $LF #LOG_FILE

Actually, there is a syntax error, but I figured it out:

echo "$VALUE" | sed '/^[ ]*$/d' | sed 'N;s/\n/ /' >> $LF #LOG_FILE

Thanks a lot. I have what I need as my correct format for the log file.

You guys Rock!!!!