Added sleep.csv. Added merged.csv. Renamed steps.sh

This commit is contained in:
2024-07-21 17:15:20 +01:00
parent 1818b69a09
commit f8d3efab55
3 changed files with 49 additions and 2 deletions

26
merge.sh Executable file
View File

@@ -0,0 +1,26 @@
#! /bin/bash
# Script to merge output from other files in this repo into a single csv
SOURCES="steps.csv sleep-mins.csv"
# Write header
echo -n "Date"
for s in $SOURCES
do
echo -n ,
echo -n $s | cut -z -d. -f1
done
echo ""
# For each unique date...
cat $SOURCES | cut -d, -f1 | sort -u | while read d
do
LINE="$d"
# ...collect the result from each source
for s in $SOURCES
do
LINE="$LINE,"`grep $d $s | cut -d, -f 2`
done
echo $LINE
done