Grep nth line after match

In this article let’s discuss about Grep nth line after match. Let’s go through the following methods without any delay.

Method 1:

awk 'c&&!--c;/pattern/{c=N}' file

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

awk 'c&&!--c;/your_pattern/{c=3}' file

Hope the above solution works.

Realted Posts : Can’t resolve ‘@capacitor-community/http’