The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using #! /bin/sh in Shell scripts sumesh.abraham Shell Programming and Scripting 4 12-01-2006 06:29 AM
Help With Shell Scripts ragha81 Shell Programming and Scripting 6 08-18-2006 09:57 PM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-12-2006 03:27 AM
shell scripts help ccp Shell Programming and Scripting 2 11-10-2005 03:31 AM
shell scripts karenshaw Shell Programming and Scripting 1 06-12-2002 09:17 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-25-2005
parola parola is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 6
Question Scripts problem...

Hi,

sprt.sh


Code:
#!/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


Code:
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


Code:
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


Code:
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 :


Code:
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

Last edited by parola; 11-25-2005 at 09:22 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0