Skip to content

Instantly share code, notes, and snippets.

@pasali
Created January 26, 2014 14:47
Show Gist options
  • Save pasali/8633826 to your computer and use it in GitHub Desktop.
Save pasali/8633826 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
DOSYA=$1
OLDIFS=$IFS
IFS=,
[ ! -f $DOSYA ] && { echo "$DOSYA bulunamadi"; exit 99; }
toplam=0
sayac=0
while read ad soyad no not
do
toplam=$(($toplam+$not))
sayac=$(($sayac + 1))
done < $DOSYA
ortalama=$(($toplam/$sayac))
while read ad soyad no not
do
if [ "$not" -gt "$ortalama" ]
then
echo $ad,$soyad,$no >> gecenler.csv
fi
done < $DOSYA
IFS=$OLDIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment