Let's say I have multiple lines similar to below in a file.
Turbo is a cat. cats are good. cats are not dog.
Coco is a black cat. cats are furry. cats are not dog.
now, if want to grep all the ^.*cat but want to specially mention to capture till first (or nth) occurrence of the word cat.
Desired Output:
Turbo is a cat
Coco is a black cat
*blah is a so and so cat*
How can I grep it?
PS: I would love to have an answer using grep (or its other variants) only.
PS: I don't want to grep ^.*cat. and then do any operation to remove the "." . I want a generic answer.