I'm using crudini to add and remove sections and parameters to an ini file. After crudini runs, there are extra empty lines left in the file that I want to clean up, so that each section is separated by only 1 empty line. The grep command in the following function works but when I try to redirect the output to a file, I get a blank file as the result.The codesctn=Section Twomypath=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )my_ini=$mypath/test.iniini_sec=$sctnfunction inidel () {  crudini --del --verbose $my_ini $ini_sec  grep -A1 . $my_ini | grep -v ^--$}function iniadd () {  crudini --set --verbose $my_ini $ini_sec  grep -A1 . $my_ini | grep -v ^--$}The data test.ini 1| [Section One] 2| Parameter1=x1 3| Parameter2=example1 4| Parameter3=one 5| 6| [Section Two] 7| Parameter1=x2 8| Parameter2=example2 9| Parameter3=two10|11| [Section Three]12| Parameter1=x3 13| Parameter2=example314| Parameter3=three15|I've tried using > $my_ini after the grep command. I don't know what it is actually doing for sure but my guess is that it is writing the result for every line finishing with the last empty line. If I use >> $my_ini It writes correctly but appends the text instead of overwriting it.
How can I output the following grep command to a file?
text processing;grep