I want the while loop to ignore blank (empty) lines and lines that contain #
I tried including sed -e 's/#.*$//' -e '/^$/d' on the input file and piping this into the while loop. This did not work.
file=$(sed -e 's/#.*$//' -e '/^$/d' foo.txt)
while IFS=: read -r f1 f2 f3 f4; do
Command
done <"$file"