Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.utils.bug > #2187
| From | Bruce Korb <bkorb@gnu.org> |
|---|---|
| Newsgroups | gnu.utils.bug |
| Subject | Re: UUencode and emails problems |
| Date | 2015-08-26 16:16 -0700 |
| Message-ID | <mailman.167.1440630984.28410.bug-gnu-utils@gnu.org> (permalink) |
| References | <3F89B7EEBF109541B08F8F5DF1936A051087E06F@CERES.corp.alfamobile.com.lb> |
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?
Back to gnu.utils.bug | Previous | Next | Find similar
Re: UUencode and emails problems Bruce Korb <bkorb@gnu.org> - 2015-08-26 16:16 -0700
csiph-web