Code:
#!/bin/sh
today=`perl /root/scripts/getYYYYMMDD.pl -0`;
yesterday=`perl /root/scripts/getYYYYMMDD.pl -1`;
old=`perl /root/scripts/getYYYYMMDD.pl -7`;
rm /root/msc/scripts/files/*$old*.*
sleep 1
/usr/bin/expect /root/msc/scripts/traffic_ssh.exp > /root/msc/scripts/files/traffic_$today.log
sleep 2
grep "DIXIN1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_DX.log
#grep "DIXIN1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log
grep "DIXIN2O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_DX.log
#grep "DIXIN2I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DX.log
grep "DIYIN1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_DY.log
#grep "DIYIN1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/
files/SUM_DY.log
grep "TLMOB1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_TELMO.log
grep "TLMOB1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_TELMI.log
grep "TLPSTO" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fil
es/SUM_TELPO.log
grep "TLPST1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_TELPO.log
grep "TLPSTI" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fil
es/SUM_TELPI.log
grep "TLPST1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_TELPI.log
grep "SRM1B1O" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' > /root/msc/scripts/fi
les/SUM_BSC.log
grep "SRM1B1I" /root/msc/scripts/files/traffic_$today.log | tail -1 | awk -F" " '{print $1","$3","$2}' >> /root/msc/scripts/f
iles/SUM_BSC.log
sleep 1
#### DX traffic####
sed -n '/^DATE/ {n; p;}' /root/msc/scripts/files/traffic_$today.log | awk -F" " '{print $1,$2}' > /root/msc/scripts/files/dat
e_time.txt
#echo "Date Time MIAMI/DX total_dev" > /root/msc/scripts/files/DX_traffic_$today.dat
awk -F"," '{x += $2} END {print x,238}' /root/msc/scripts/files/SUM_DX.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/DX_traffi
c_$today.dat
sleep 1
cp /root/msc/scripts/files/DX_traffic_$today.dat /root/msc/scripts/graph/DX_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/dx.pg > /root/msc/scripts/graph/dx.png
sleep 1
######## DY Traffic #############
#echo "Date Time New-York/DY total_dev" > /root/msc/scripts/files/DY_traffic_$today.dat
awk -F"," '{x += $2} END {print x,238}' /root/msc/scripts/files/SUM_DY.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/DY_traffi
c_$today.dat
sleep 1
cp /root/msc/scripts/files/DY_traffic_$today.dat /root/msc/scripts/graph/DY_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/dy.pg > /root/msc/scripts/graph/dy.png
######### Telesur Mobile Originating ################
sleep 1
#echo "Date Time Telesur-Mobile/Originating total_dev" > /root/msc/scripts/files/TELMO_traffic_$today.dat
awk -F"," '{x += $2} END {print x,480}' /root/msc/scripts/files/SUM_TELMO.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELMO_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELMO_traffic_$today.dat /root/msc/scripts/graph/TELMO_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELMO.pg > /root/msc/scripts/graph/TELMO.png
######### Telesur Mobile Terminating ################
sleep 1
#echo "Date Time Telesur-Mobile/terminating total_dev" > /root/msc/scripts/files/TELMI_traffic_$today.dat
awk -F"," '{x += $2} END {print x,480}' /root/msc/scripts/files/SUM_TELMI.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELMI_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELMI_traffic_$today.dat /root/msc/scripts/graph/TELMI_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELMI.pg > /root/msc/scripts/graph/TELMI.png
################### Telesur PSTN Originating ##################################################
sleep 1
#echo "Date Time Telesur-PSTN/Originating total_dev" > /root/msc/scripts/files/TELPO_traffic_$today.dat
awk -F"," '{x += $2} END {print x,120}' /root/msc/scripts/files/SUM_TELPO.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELPO_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELPO_traffic_$today.dat /root/msc/scripts/graph/TELPO_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELPO.pg > /root/msc/scripts/graph/TELPO.png
#####################Telesur PSTN Terminating #################################################
sleep 1
#echo "Date Time Telesur-PSTN/terminating total_dev" > /root/msc/scripts/files/TELPI_traffic_$today.dat
awk -F"," '{x += $2} END {print x,120}' /root/msc/scripts/files/SUM_TELPI.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/TELPI_tra
ffic_$today.dat
sleep 1
cp /root/msc/scripts/files/TELPI_traffic_$today.dat /root/msc/scripts/graph/TELPI_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/TELPI.pg > /root/msc/scripts/graph/TELPI.png
##################### Digicel BSC ###############################################
sleep 1
#echo "Date Time BSC total_dev" > /root/msc/scripts/files/BSC_traffic_$today.dat
awk -F"," '{x += $2} END {print x,5766}' /root/msc/scripts/files/SUM_BSC.log > /root/msc/scripts/files/test.tmp
paste -d" " /root/msc/scripts/files/date_time.txt /root/msc/scripts/files/test.tmp >>/root/msc/scripts/files/BSC_traff
ic_$today.dat
sleep 1
cp /root/msc/scripts/files/BSC_traffic_$today.dat /root/msc/scripts/graph/BSC_test.dat
chmod 777 /root/msc/scripts/graph/*.dat
gnuplot /root/msc/scripts/graph/BSC.pg > /root/msc/scripts/graph/BSC.png
sleep 1
################################################################################################################