From: Gustav Eek Date: Sat, 24 Oct 2020 08:06:43 +0000 (+0200) Subject: [event-participant] Add sorting and unique X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=df40017f5690f4bdd97a22b48724b9a5c67a35ba;p=users%2Fgustav%2Fscripts.git [event-participant] Add sorting and unique --- 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