Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Store argument variables immediately
- INPUTFILE=$1
- OUTPUTFILE=$2
- EXCELFILE=$3
- # Create the files
- touch "$OUTPUTFILE"
- echo -e "AM \t telikos" >> "$OUTPUTFILE"
- touch "$EXCELFILE"
- echo -e "emails"
- i=1
- # Read file line by line, delimiter is a Tab character, "IFS=" for space char
- while IFS=$'\t' read -r AM parousies ergasia1 ergasia2 ergasia3 thema1 thema2
- do
- # skip the first line
- test $i -eq 1 && ((i=i+1)) && continue
- #find count of zeros in var $parousies
- ABSENCES=$(grep -o "0" <<<"$parousies" | wc -l)
- #concatenate AM and email
- EMAIL="${AM}@cs.teikal.gr"
- # GRADE=`expr \( 0.2 \* $ergasia1 + 0.2 \* $ergasia2 + 0.2 \* $ergasia3 + 0.25 \* $thema1 + 0.25 \* $thema2\) /5`
- GRADE=$(( ( 0.2 \* $ergasia1 + 0.2 \* $ergasia2 + 0.2 \* $ergasia3 + 0.25 \* $thema1 + 0.25 \* $thema2 ) / 5 ))
- echo "GRADE: " $GRADE
- # echo -e "\n"$AM $parousies $ergasia1 $ergasia2 $ergasia3 $thema1 $thema2
- if [ ${AM:0:4} -gt 2015 ]
- then
- ONGRAD=1
- echo -e "Ptixio: " $ONGRAD
- else
- ONGRAD=0
- echo -e "Ptixio: " $ONGRAD
- fi
- # will fidn occurences of char "0" in var parousies
- done < "$INPUTFILE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement