The main task: the file has blocks of text beginning with the current date ( date +"%d/%m/%y" ) and ending with an empty line or lines. My final script should erase this block if it matches the current date. I planned to go in a loop. When coinciding with the date - check the box (stop output to a file). If the line is blank and the checkbox is checked, uncheck the checkbox. For now, I was just trying to keep track of empty lines, but it doesn't work.
#!/bin/bash for line in `cat ./test2`; do if [[ "$line" != "" ]] then echo $line else echo fi done View file:
abc1 abc2 abc3 Here is how these blank lines get lost in the loop.