Last active
April 24, 2017 18:10
-
-
Save hamidzr/ae21587a165d368fc4c7477afb6ae31c to your computer and use it in GitHub Desktop.
a helper to combine readme files for cs2201 (Vanderbilt)
This file contains 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 | |
# rename each student's readmefile to his/her score and save to a single directory | |
# depends on these tools: bash, file, grep, unzip, sed | |
#relative output file address | |
output='readmes.txt' | |
echo '' > $output | |
for filename in *.*; do | |
printf '\n====== Begin student readme =======\n'>> $output | |
if file $filename | grep -iq word ; then | |
unzip -p $filename word/document.xml | sed -e 's/<\/w:p>/\n/g; s/<[^>]\{1,\}>//g; s/[^[:print:]\n]\{1,\}//g' >> $output | |
else | |
cat $filename >> $output | |
fi | |
printf "\n\n..:: Score: $filename ::.." >> $output | |
printf '\n====== End of student readme =======\n\n\n\n'>> $output | |
done | |
echo "combined file generated at $output" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment