Added sleep.csv. Added merged.csv. Renamed steps.sh
This commit is contained in:
26
merge.sh
Executable file
26
merge.sh
Executable 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
|
||||
Reference in New Issue
Block a user