2 added 157 characters in body
source | link

I am trying to print the matched line and the 4th line from the matched line (line containing the expression I am searching for).

I have been using the following code: sed -n 's/^[ \t]*//; /img class=\"devil_icon/,4p' input.txt

But this only prints the matched line.

This prints only the 4th line. awk 'c&&!--c;/img class=\"devil_icon/{c=4}' input.txt

I need to print both the matched line and the 4th line only.

I am trying to print the matched line and the 4th line from the matched line (line containing the expression I am searching for).

I have been using the following code: sed -n 's/^[ \t]*//; /img class=\"devil_icon/,4p' input.txt

But this only prints the matched line.

I am trying to print the matched line and the 4th line from the matched line (line containing the expression I am searching for).

I have been using the following code: sed -n 's/^[ \t]*//; /img class=\"devil_icon/,4p' input.txt

But this only prints the matched line.

This prints only the 4th line. awk 'c&&!--c;/img class=\"devil_icon/{c=4}' input.txt

I need to print both the matched line and the 4th line only.

1
source | link

Print Matching line and nth line from the matched line

I am trying to print the matched line and the 4th line from the matched line (line containing the expression I am searching for).

I have been using the following code: sed -n 's/^[ \t]*//; /img class=\"devil_icon/,4p' input.txt

But this only prints the matched line.