grep "foo" myfile.txt
prints all matching lines in my file.
Now I want to replace the full line with another string. How can I do that?
If you're matching a substring of the whole line, you can either use sed's
or use the
If you don't want to type multiline commands at the prompt, you can put it in a script instead: