Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Store argument variables immediately
  4. INPUTFILE=$1
  5. OUTPUTFILE=$2
  6. EXCELFILE=$3
  7.  
  8. # Create the files
  9. touch "$OUTPUTFILE"
  10. echo -e "AM \t telikos" >> "$OUTPUTFILE"
  11.  
  12. touch "$EXCELFILE"
  13. echo -e "emails"
  14.  
  15.  
  16. i=1
  17. # Read file line by line, delimiter is a Tab character, "IFS=" for space char
  18. while IFS=$'\t' read -r AM parousies ergasia1 ergasia2 ergasia3 thema1 thema2
  19. do
  20. # skip the first line
  21. test $i -eq 1 && ((i=i+1)) && continue
  22.  
  23. #find count of zeros in var $parousies
  24. ABSENCES=$(grep -o "0" <<<"$parousies" | wc -l)
  25. #concatenate AM and email
  26. EMAIL="${AM}@cs.teikal.gr"
  27. # GRADE=`expr \( 0.2 \* $ergasia1 + 0.2 \* $ergasia2 + 0.2 \* $ergasia3 + 0.25 \* $thema1 + 0.25 \* $thema2\) /5`
  28. GRADE=$(( ( 0.2 \* $ergasia1 + 0.2 \* $ergasia2 + 0.2 \* $ergasia3 + 0.25 \* $thema1 + 0.25 \* $thema2 ) / 5 ))
  29. echo "GRADE: " $GRADE
  30. # echo -e "\n"$AM $parousies $ergasia1 $ergasia2 $ergasia3 $thema1 $thema2
  31.  
  32. if [ ${AM:0:4} -gt 2015 ]
  33. then
  34. ONGRAD=1
  35. echo -e "Ptixio: " $ONGRAD
  36. else
  37. ONGRAD=0
  38. echo -e "Ptixio: " $ONGRAD
  39. fi
  40. # will fidn occurences of char "0" in var parousies
  41.  
  42. done < "$INPUTFILE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement