Error message while openning the xls file generated by UNIX

Hi All,

I have created a unix script to mail the xls file.This is being done using mailx command

fdate=`tail -1 abc.xls | cut -c1-8`
SUBJECT="CARD GL Exceptions : ${ENV} for ${fdate}"
destname=CARD_GL_Exceptions_$fdate
sed 's/#BUSINESS/BUSINESS/1' abc.xls > abc2.xls
mv abc2.xls abc.xls
line_count=`wc -l abc.xls|awk '{print $1}'`
echo $line_count
if [ $line_count -gt 1 ]
then
(echo "Hi,
Please find  attached.
Regards";uuencode abc.xls $destname.xls) | /usr/bin/mailx -s  "${SUBJECT}"  ${TO} ${CC}

Everything is working fine except the fact that am getting an error messgae every time i open the file

Error Message : "The file you are trying to open is in a different format than specified by the file extension.Verify that file is not corrupted and is from a trusted source.Doyou want to open the file"

I have to click on yes every time .I need to get rid of this error message.Kindly help.

Regards,
Karthik

What happens if you do not SED the file? And email it.
Can you open it then?

By the way, xls files can be funny. I often work with csv files which are easier to manipulate and without fear of disrupting an embedded formatting commands.

2 Likes

Thanks for the suggestion joeyg : ) I used CSV file instead of xls and it worked