Hi All -
I am new to unix and scripting. I was asked to export a sql output into .csv format and email the attachment. I could do this however i see some square like boxes or special char at the end of the headings and data values in .csv file. I could not fix this and will need your help.
the .ksh script i am using for your reference:
#!/bin/ksh
# Sample script
# Author: xyz
# Initial - 11/07/2012
. ~prod/dba/oracle_connection_info
. ~prod/xyz-Feeds/common/setenv_common_cm.ksh
OUT_FILE_FEEDS=./FeedAlert.csv
LOG_FILE=$RS_LOG/FeedAlert.log
echo "Oracle SID : " $ORACLE_SID
echo "out file feeds windows service : " $OUT_FILE_FEEDS
sqlplus -s ${ORA_ID}/${ORA_PASS}@$ORACLE_SID < ~prod/xyz-Feeds/sql/Records.sql > FeedAlert.csv
cat FeedAlert.csv |uuencode FeedAlert.csv FeedAlert.csv | mailx -r ${EMAIL_FROM_ADDRESS} -s \
'Alert : Data Feed - Missing Data for Today' xyz@yahoo.com
echo sent mail.
echo ending script
# End of script
Records.sql goes like this in another file:
SET LINESIZE 1500
SET PAGESIZE 100
SET COLSEP ','
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING ON;
SELECT * from emp;
I will really appreciate it if you can help me fix this . Thanks!