]> git.g-eek.se Git - users/gustav/scripts.git/commitdiff
[event-participant] Add sorting and unique
authorGustav Eek <gustav.eek@fripost.org>
Sat, 24 Oct 2020 08:06:43 +0000 (10:06 +0200)
committerGustav Eek <gustav.eek@fripost.org>
Sun, 25 Oct 2020 09:56:00 +0000 (10:56 +0100)
event-participant

index aee33cb983fb5b4e1f5d37c5d9df3b98da2cb20d..a14e3aab6cd29067c0b17582064d94a2d4abf670 100755 (executable)
@@ -29,7 +29,13 @@ participant="${BASH_REMATCH[2]}"
 [[ "$info" =~ (Date: )([^:]*) ]]
 date=$(date -I -d "${BASH_REMATCH[2]}")
 
-echo "${participant},${date}" | tee -a "$event"
+echo "${participant},${date}" |
+    cat "$event" - |
+    sort -t',' -k 2 -k 1 |
+    uniq |
+    grep -v "^$" \
+        > "$event.sorted"
+mv "$event.sorted" "$event"
 
 # Print summary