I have a line such as:
sed -i 's/mystring/newstring/' $target
This command will change all mystring to newstring.
What I want now is: when the program sees mystring, how can I check for the current line if the string searchstring exists or not? If it exists, newstring is 1; otherwise, newstring is 0.