I have a file that I want to update relatively frequently.
What needs to be done is that a specific part of the file would be changed to include some more lines. I am doing it with
So this works:
sed -i "/import:/a\$IMPORTED" file
This works as expected the first time. On the next re-runs this commands appends over and over the same lines.
How would I approach this so that I somehow remove everything I imported before I run it again?
E.g. use some following lines to anchor in the beginning that I know were not added automatically or something like that?