#!/bin/bash now_time=$(date "+%Y-%m-%d, %H:%M") problems_completed=$(ag --noaffinity "^#.*completed" --stats . | tail -n5 | head -n1 | cut -d" " -f1) problems_towork=$(ag --noaffinity "^#.*work" --stats . | tail -n5 | head -n1 | cut -d" " -f1) outfile=./progress.md read -r -d '' file_template << EOM | $now_time\t | $problems_completed\t | $problems_towork\t | EOM sed -i "s/^\^progresschart/$file_template\n\^progresschart\n/" "$outfile"; #printf "$file_template" >> $outfile;