I have a file like:
file.foo
file2.foo
file.bar
file3.foo
Now I want to return only lines that end with .foo, but I want to rename all occurrences of file with blag. In this case that means skipping over file.bar entirely. How do I go about doing it with just sed? Essentially what I'm doing currently is:
grep '\.foo$' input | sed -e's/file/blag/'
But I would like to cut the grep out.
This question is roughly based on a pipeline I made for this answer