From df40017f5690f4bdd97a22b48724b9a5c67a35ba Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Sat, 24 Oct 2020 10:06:43 +0200 Subject: [PATCH] [event-participant] Add sorting and unique --- event-participant | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/event-participant b/event-participant index aee33cb..a14e3aa 100755 --- a/event-participant +++ b/event-participant @@ -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 -- 2.39.5