Linux grep command
I have a file, called test.txt which contains the bellow contents: Mouse eats cheese. Cat eats mouse. Dog eats cat. Lamb eats dog. Worm eats lamb. Print the line where "Dog" is availabe: grep 'Dog' test.txt The output will be: Dog eats cat. Show line above and below of "Dog": grep -C 1 'Dog' test.txt The output will be: Cat eats mouse. Dog eats cat. Lamb eats dog. If I provide - C 2 then output contains 2 lines above and below of the "Dog".