Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Bruce Korb Newsgroups: gnu.utils.bug Subject: Re: UUencode and emails problems Date: Wed, 26 Aug 2015 16:16:16 -0700 Lines: 47 Approved: bug-gnu-utils@gnu.org Message-ID: References: <3F89B7EEBF109541B08F8F5DF1936A051087E06F@CERES.corp.alfamobile.com.lb> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1440630985 2305 208.118.235.17 (26 Aug 2015 23:16:25 GMT) X-Complaints-To: action@cs.stanford.edu To: RALPH ABI RACHED , "bug-gnu-utils@gnu.org" Envelope-to: bug-gnu-utils@gnu.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <3F89B7EEBF109541B08F8F5DF1936A051087E06F@CERES.corp.alfamobile.com.lb> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: bug-gnu-utils@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU utilities List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.utils.bug:2187 On 08/26/15 11:44, RALPH ABI RACHED wrote: > WEEKDAY=`date '+%a'` > if [[ "$WEEKDAY" = "Sun" ]] > then > print "Week Number,From,To,Idle Average (%),Load Average (%)" > $TRASH/week_avg.sar > SAR_FILES_COUNT=`ls -ltr ${SAR_ARCHIVE_DIR}/sar_${THIS_YEAR}* | wc -l` > > let i=1 > while (( i < SAR_FILES_COUNT )) > do > let j=i+7 > ls -ltr ${SAR_ARCHIVE_DIR}/sar_${THIS_YEAR}* | awk '{print $9}' | sed -n "${i},${j}p" | xargs grep Average > $TRASH/temp.sar > let SUM=0 > while read LINE > do > IDLE_VAL=`echo -e $LINE | awk '{print $5}'` > let SUM=SUM+IDLE_VAL > done < $TRASH/temp.sar > let AVG=SUM/7 > > FIRST_DAY=`sed -n '1p' $TRASH/temp.sar | awk -F_ '{print $3}' | awk -F: '{print $1}'` > LAST_DAY=`sed -n '7p' $TRASH/temp.sar | awk -F_ '{print $3}' | awk -F: '{print $1}'` > let WEEK_NUMBER=${j}/7 > let LOAD_AVG=100-AVG > print "${WEEK_NUMBER},${FIRST_DAY},${LAST_DAY},${AVG},${LOAD_AVG}" >> $TRASH/week_avg.sar > let i=j > done > uuencode $TRASH/week_avg.sar weekly_avg_$CURRENT_DATE.csv >> /svw/svwtst1b/work/billops/temp_mail.sar > fi > > echo -e $TXT_MAIL >> /svw/svwtst1b/work/billops/temp_mail.sar > > nail -r "BOP" -s "System Activity Reporter" $TO < /svw/svwtst1b/work/billops/temp_mail.sar Wow. A) why not just "tar -cJf" it and attach using MIME. B) if you have to roll your own, wny not use "shar"? it just does all that stuff for you. C) you can use compression options with shar, too, to make it much moore compact than just "uuencoding" all the files D) *plus* if files meet the criteria for "text" files, the uuencoding step can be skipped. So, what are you really trying to accomplish?