Shell scripts problem...

Hi,

sprt.sh

#!/bin/ksh
###############################################################################
# -----------------------------------------------------------------------------
#
# ------------------------------------------------------------------------------
################################################################################                                                                                                              
# Variable list                                                 
FILE="/usr/errors/errors_07/unknown_07.txt"             
MAILING_LIST="mailbox_07.cfg"                                                   
LIST_SITE=`cut -d# -f1 $FILE |sort -u`                                       
PATH="/usr/errors/errors_07/rejet_07/"                                      
UNLOAD="dbaccess katali ../error_07_output.sql"                                   
                                                                             
# unload unknown_07.txt                                                      
$UNLOAD                                                                      

# Extract site                                                               
for SITE in ${LIST_SITE}                                                     
do                                                                           
                                                                             
# Extract SITE                                                               
echo "Extraction infos for centre $SITE..."                            
                                                                             
echo "Hi, \n" >$PATH$SITE.txt                                          
echo " This is list of all errors found :\n" >>$PATH$SITE.txt
echo "Clothes   Colors   Type     Age         Eyes     Hair  \n" >>$PATH$SITE.txt      
                                                                             
grep $SITE $FILE |sed 's/\#/    /g' >>$PATH$SITE.txt                   
                                                                             
echo "\n" >>$PATH$SITE.txt                                                 
echo "This is real errors from you ? \n" >>$PATH$SITE.txt

echo "Where is send ? \n" >>$PATH$SITE.txt

echo "CDLT.\n" >>$PATH$SITE.txt
                                                                             
# Send Mail                                                                  
TO=`grep ^$SITE $MAILING_LIST|cut -d: -f2`                                   
                                                                             
# Convert file in DOS mode...                                       
unix2dos -ascii $PATH$SITE.txt $PATH$SITE.txt 2>/dev/null                
                                                                             
echo "Send to $PATH$SITE.txt a $TO"                              
SEND=`cat $PATH$SITE.txt`                                                  
                                                                             
# Send mail auto to center                                        
mailx -r myemail_is_here@testers.com -s "$SITE - Real Errors - Error 07" myemail_is_here@testers.com ${TO} < $PATH$SITE.txt 
                 
done            

error_07_output.sql

unload to /usr/errors/errors_07/unknown_07.txt              
select clothes[1,4],colors,type,date,hair         
from kalatina                                                     
where errors_za="07"                                                  
order by 6, 1,2,3,4 

unknown_07.txt

CELI#MLT#L65041205#LONG#24/11/2005#BRO#     
NAFN#YELLOWBL#K354945911#04C05#22/11/2005#COL#
GAP#BLEUE#05382806#SMALL#12/10/2005#PIN#  
GAP#BLEUE#704371650#MEDIUM#20/10/2005#WHI#   
PI*A##5868142897#UNKOWN#01/11/2005#RED#        
PI*A##7552242751#0QV75#04/08/2005#DEP#        
PI*A#BROWN#H638042337#04B05#24/11/2005#SAM#  
PI*A#BROWN#L135034575#04C05#23/11/2005#UNK#  

mailbox_07.cfg

CELI:email_is_here@betatester.com
NAFN:email_is_here@betatester.com
GAP:email_is_here@betatester.com
PI*A:email_is_here@betatester.com

Hi,

someone can help me, when i run my script, sprt.sh, this unload a txt file at here /usr/errors/errors_07/unknown_07.txt and split by clothes ( in my exampe
CELI ) and then send a email via sprt.sh and looks in mailbox_07.cfg aslo for send other mail at persons.

my probleme is when i have a file like unknown_07.txt with :

CELI#MLT#L65041205#LONG#24/11/2005#BRO#     
NAFN#YELLOWBL#K354945911#04C05#22/11/2005#COL#
GAP#BLEUE#05382806#SMALL#12/10/2005#PIN#  
GAP#BLEUE#704371650#MEDIUM#20/10/2005#WHI#   
PI*A##5868142897#UNKOWN#01/11/2005#RED#        
PI*A##7552242751###DEP#        
PI*A#BROWN#H638042337#04B05#24/11/2005#SAM#  
PI*A#BROWN###23/11/2005##

PI*A is splited and sent via mail, but when i receive mail is empty of contains

So there are a errors ( PI*A##5868142897#UNKOWN#01/11/2005#RED# ) when there are 2 or more this "##" this make a empty email,
so how i can remove all "#" and remplace with a 1 space ?????

Plateform : Sun 5.8

You're joking, aren't you?

sed 's/##*/<spc>/g'

Replace the "<spc>" with a literal space.

bakunin