Use AWK to display x-th and y-th lines after a regex match

In a script you might be interested to keep 2 or more lines after a regex match ,
the line that interest you are not always going to be right after the match ,
the first one might be X lines after the match and the second one Y lines afters the match

in this example , i’m interested in keeping the lines with the price and the number in stock
i’m going to use awk to search for item desc , and display the 4th line after the match, and 6th line.

Leave a Comment

Your email address will not be published. Required fields are marked *