diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..38eae09 --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./sleep-day.sh && ./steps-day.sh && ./merge.sh >out.csv diff --git a/sleep-day.sh b/sleep-day.sh index 3208381..49231b9 100755 --- a/sleep-day.sh +++ b/sleep-day.sh @@ -4,8 +4,8 @@ # into a csv file cat export.xml | - grep 2024- | - grep 'type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="HUAWEI Health"' | + grep -e 202[4567]- | + grep 'type="HKCategoryTypeIdentifierSleepAnalysis" sourceName="HUAWEI Health' | egrep -o 'startDate[^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+ ' | while read line do diff --git a/steps-day.sh b/steps-day.sh index 0c61e6a..2891f24 100755 --- a/steps-day.sh +++ b/steps-day.sh @@ -4,8 +4,8 @@ # into a csv file cat export.xml | - grep 2024- | - grep 'type="HKQuantityTypeIdentifierStepCount" sourceName="HUAWEI Health"' | + egrep 202[45678]- | + grep 'type="HKQuantityTypeIdentifierStepCount" sourceName="HUAWEI Health' | cut -d\" -f 14,16 | tr \" \ | cut -d\ -f 1,4 |