34 lines
1.2 KiB
Fish
Executable file
34 lines
1.2 KiB
Fish
Executable file
#!/usr/bin/env fish
|
|
|
|
# Script by James Eagan <james.eagan@telecom-paris.fr>
|
|
# This is a quick-n-dirty hack.
|
|
# First time shared: 2024-10-08
|
|
# Depends on fish shell, csv-util, and sqlite-csv
|
|
# Usage: ./process.fish in a directory with all the .csv files to process
|
|
|
|
mkdir -p processed
|
|
rm -f summary.csv summary-short.csv
|
|
|
|
for i in *.csv
|
|
echo "::: $i" 1>&2
|
|
csv-util $i -., --insep \; -s , --split-ects --calc-avg --head -2 > processed/$i
|
|
sqlite-csv --md processed/$i 'select "Code","Note initiale","Note finale","Note finale transposée",ECTS from data' > processed/(basename $i .csv).md
|
|
end
|
|
|
|
|
|
for i in processed/*.md
|
|
echo -n "### "; echo (basename $i "-Tableau 1.md")
|
|
cat $i
|
|
echo
|
|
end
|
|
|
|
echo 'Nom,"Note finale",ECTS,Mention' > summary.csv
|
|
for i in processed/*.csv;
|
|
set name (basename $i "-Tableau 1.csv");
|
|
echo -n "$name," >> summary.csv;
|
|
#cat $i | sqlite-utils memory stdin 'select "Note finale" as Moyenne,ECTS,"Note finale transposée" as Mention from stdin' --csv | tail -1 >> summary.csv
|
|
cat $i | sqlite-csv --csv 'select "Note finale" as Moyenne,ECTS,"Note finale transposée" as Mention from data' | tail -1 >> summary.csv
|
|
end
|
|
|
|
sqlite-csv --md summary.csv 'select Nom,"Note finale" as Moyenne,ECTS,Mention from data'
|