What would be the best way of going about this.
If a line starts with a string, replace that whole line with new string If no line in the file starts with that string, append it to the file
Ex:
file.txt:
FOO=blah
BAR=bleh
GIN=blop
How can I replace the FOO line if it exists or append to the file if no line starts with FOO?