Browse Source

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.
master
Craig Oates 1 year ago
parent
commit
a067729bef
  1. 6
      separator.sh

6
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

Loading…
Cancel
Save