Last active
April 6, 2016 05:22
-
-
Save georgeteo/9d8ec0fa4a533d87c88e57b76e4fb04a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Instruction: | |
# move this script to appropriate directory | |
# e.g., mv cs154_grader.sh cs154-2016-graders/hw1 | |
# TO CHANGE: | |
# 1. Change HW var here | |
# 2. Change cnet id in awk param. | |
HW="hw1" | |
# Remove to_grade.vimscript if it exists | |
rm to_grade.vimscript | |
# Search through alloc looking for grader_cnet | |
# Generates the vimscript that will open each students homework in | |
# a new vim pane with the grader remarks in a vsplit | |
awk -v filename="$HW" -F, '/georgeteo/ {print "tabe export/" $2 "/"filename".txt \n vsplit grade/" $2 "-q" $3 ".txt"}' alloc.csv >> to_grade.vimscript | |
# Check that counts are accurate before opening vim | |
echo "Grep says there are this many files to grade:" | |
grep georgeteo alloc.csv | wc -l | |
echo "Vim will open these many files to grade (should equal Grep value):" | |
echo $(($(less to_grade.vimscript | wc -l)/2)) | |
# If y, open files in vim for grading | |
while true; do | |
read -p "Do you wish proceed (select y if the two values are the same)?" yn | |
case $yn in | |
[Yy]* ) vim -S to_grade.vimscript; break;; | |
[Nn]* ) exit;; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment