From a067729bef0254ea11f42e24f010207c2fc17b9a Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Tue, 21 Mar 2023 00:30:47 +0000 Subject: [PATCH] fix filepath bug when processing file with ripgrep in separator.sh. The script was processing lm1-exhibiton-all.csv twice because I forgot to replace the hardcoded value ('lm1') in the path used by rg. The code both processes lm1-exhibition-all.csv and lm2-exhibition-all.csv files. --- separator.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 separator.sh diff --git a/separator.sh b/separator.sh old mode 100644 new mode 100755 index 6804a01..3cfe82e --- a/separator.sh +++ b/separator.sh @@ -44,14 +44,14 @@ hourBreakdown () { } dailyBreakdown () { - lm="$1"; # Light Meter (either 1 or 2) + lm=$1; # Light Meter (either 1 or 2) mkdir -p "data/light-meter-$lm"; for month in {6..8} ; do for day in {1..31} ; do if [[ $day -lt 10 ]]; then touch "data/light-meter-$lm/2021-0$month-0$day.csv"; echo "time,reading" > "data/light-meter-$lm/2021-0$month-0$day.csv"; - rg "2021-0$month-0$day" "data/lm1-exhibiton-all.csv" >> "data/light-meter-$lm/2021-0$month-0$day.csv"; + rg "2021-0$month-0$day" "data/lm$lm-exhibiton-all.csv" >> "data/light-meter-$lm/2021-0$month-0$day.csv"; if [[ $month -lt 10 ]]; then hourBreakdown "0$day" "0$month" $lm; else @@ -60,7 +60,7 @@ dailyBreakdown () { else touch "data/light-meter-$lm/2021-0$month-$day.csv"; echo "time,reading" > "data/light-meter-$lm/2021-0$month-$day.csv"; - rg "2021-0$month-$day" "data/lm1-exhibiton-all.csv" >> "data/light-meter-$lm/2021-0$month-$day.csv"; + rg "2021-0$month-$day" "data/lm$lm-exhibiton-all.csv" >> "data/light-meter-$lm/2021-0$month-$day.csv"; if [[ $month -lt 10 ]]; then hourBreakdown $day "0$month" $lm; else