I am trying to check a string in a text file. If string1 does not exist, add string1 after line 2. Else string1 does nothing.
Here is what I still have:
if [ string1 does not exisit ] //Stuck at this
then
sed '/string2/ a\ string1' myfile
fi
Also, how can the "/" character be included in my lines?
source
share