Hi
I have a file which I am reading line by line and processing it.
But the last line is not getting read in the file loop until I put an enter in the end.
#!/bin/ksh -p
v_org_id=${P1}
FILE=${P2}
NEW_FILE_NAME=$APPLPTMP/b1.txt
BAKIFS=$IFS
IFS=$'\n'
exec 0<"$FILE"
echo "File to be processed.....: ${FILE}"
while read -r line
do
v_initial=`echo "$line" |cut -d'|' -f1-3`
echo "v_initial.....: ${v_initial}"
v_last_name=`echo "$line" |cut -d'|' -f4`
v_first_name=`echo "$line" |cut -d'|' -f5`
OUTPUT=`sqlplus -s ${LOGIN} <<EOF
set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
var mavar varchar2(100);
Emp_first_name('${v_first_name}')
into :mavar from dual;
echo"$v_initial"'|'""$OUTPUT"'|'">> $NEW_FILE_NAME
done
print mavar;
exit;
EOF`