Quantcast
Channel: d0wn
Viewing all articles
Browse latest Browse all 73

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 73

Trending Articles