Bonjour,
voila mon script :
#!/bin/sh
A=$(date '+%m'"_20"'%y')
if [ -z "$n" ] ; then
echo "Vous n'avez pas passe parametre"
else
case $n in
Call) tail -1 StatProfileDailyCall_$A.csv |awk -F"," '{print $2}' > test1.txt
;;
Call1) tail -1 StatProfileDailyCall_$A.csv |awk -F"," '{print $3}' > test1.txt
;;
Call2) tail -1 StatProfileDailyCall_$A.csv |awk -F"," '{print $5}' > test1.txt
;;
Duration1) tail -1 StatProfileDailyDuration_$A.csv |awk -F"," '{print $2}' > test1.txt
;;
Duration2) tail -1 StatProfileDailyDuration_$A.csv |awk -F"," '{print $3}' > test1.txt
;;
Duration3) tail -1 StatProfileDailyDuration_$A.csv |awk -F"," '{print $6}' > test1.txt
;;
Duration4) tail -1 StatProfileDailyDuration_$A.csv |awk -F"," '{print $7}' > test1.txt
;;
Mbox) tail -1 StatProfileDailyMbox_$A.csv |awk -F"," '{print $2}' > test1.txt
;;
Msg) tail -1 StatProfileDailyMsg_$A.csv |awk -F"," '{print $2}' > test1.txt
;;
*) exit
;;
esac
fi
cat test1.txt
exit 0
Les fichiers stats sont de ce type :
Date,MboxCount,ActiveMbox,
01/12/2006,78182,0,
02/12/2006,78795,0,
03/12/2006,79311,0,
04/12/2006,79989,0,
05/12/2006,80659,0,
06/12/2006,81386,0,
07/12/2006,82129,0,
08/12/2006,82831,0,
09/12/2006,83302,0,
10/12/2006,83739,0,
Je recupere les champs qui m'interessent dans le script (la derniere ligne et une ou plusieurs colonnes non vides) et
je n'arrive pas a lancer le script :
Script. sh Call1
Merci de votre aide
