]> git.rmz.io Git - dotfiles.git/blobdiff - bin/work/anwesenheit_klausur
merge bin from shada
[dotfiles.git] / bin / work / anwesenheit_klausur
diff --git a/bin/work/anwesenheit_klausur b/bin/work/anwesenheit_klausur
new file mode 100755 (executable)
index 0000000..0fd7f2b
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+
+open(CSV_FILE, ">data.csv");
+
+my $header_done;
+
+print CSV_FILE "Name,Vorname,Matrikel,Wid.,prf\n";
+
+while (<*.xls>) {
+    my $fileName = $_;
+    my @file = `xls2csv $fileName 2>&1` ;
+
+    my $cnt = 0;
+    while (<@file>) {
+        $cnt++;
+        if ($cnt < 4) { next; }
+        if ( m/HISsheet/ ) { next; }
+
+        my @data = split(",", $_);
+#         print "@data";
+        my @orderedData = @data[2,1,0,4];
+        push(@orderedData, substr($fileName,0, -4));
+#         print "@orderedData";
+#         print CSV_FILE "$_," . substr($fileName,0, -4) . "\n";
+        print CSV_FILE join(",", @orderedData) . "\n";
+    }
+}
+
+close(CSV_FILE);