Skip to content

Instantly share code, notes, and snippets.

@edi33416
Last active January 24, 2022 13:32
Show Gist options
  • Save edi33416/1ba93db06a9a7ecf6f4fc528ab7958a0 to your computer and use it in GitHub Desktop.
Save edi33416/1ba93db06a9a7ecf6f4fc528ab7958a0 to your computer and use it in GitHub Desktop.
This parses MS Teams meeting attendance lists
#!/bin/bash
# Make sure your lists are in UTF-8.
# By default, on Windows, a downloaded file is saved using UTF-16 LE
# You can use the [convertutf16letoutf8.sh](https://gist.github.com/edi33416/834336a6866715088af2e603dfac4c01#file-convertutf16letoutf8-sh) script
if [ ! $# -eq 1 ]
then
echo -e "Error: wrong arguments.\n\tUsage: $0 <stud-attendance-list-dir>"
exit 1
fi
if [ ! -d $1 ]
then
echo -e "Error: $1 doesn't exist or isn't a directory.\n\tUsage: $0 <stud-attendance-list-dir>"
exit 1
fi
pushd "$1"
mkdir utf-8
for i in *.csv;do
echo $i
iconv -f utf-16 -t utf-8 < "$i" > utf-8/"$i"
done
cat utf-8/meetingAttendanceList* | grep -v "Full Name" | sed -n 's/\(.*(\).*/\1/p' | cut -d '(' -f 1 | sort | uniq > tmp.txt
awk '{ printf "%s ",$NF;for (i=1;i<=NF-1;i++) { printf " %s",$i } printf "\n" }' tmp.txt | tr -s ' '| sort -k1,1 > students-list.txt
rm tmp.txt
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment