Hello all, new to this site and to scripting.
I am trying to search for the line with "CALIBRATE" in a file, and remove the leading # from the line with the following lines:
cat $F1 | sed -e '/CALIBRATE/s/^#//' > $F1
cat $F2 | sed -e '/CALIBRATE/s/^#//' > $F2
cat $F3 | sed -e '/CALIBRATE/s/^#//' > $F3
Another part of my script does basically the same thing in reverse, that is, add the leading # to the line. However, when the script is run several times in a row with the different options, one of the output files are left either empty or scrambled (seen as binary).
My guess is that something happens when run again and there is no # to remove at the beginning of the line.
Any help would be much appreciated.
PG