awk !/searchterm/ ~/.filename > temp && mv temp ~/.filename
That will replace any line containing "searchterm" in the file "filename"
Example:
Input:
echo "Hello World"
echo "Goodbye World"
echo "Hi Developers"
Output:
awk !/Hello/ ~/.greetings > temp && mv temp ~/.greetings
echo "Goodbye World"
echo "Hi Developers"
awk !/world/ ~/.script > temp && mv temp ~/.script
echo "Hi Developers"