How to capture the first occurrence of a pattern using grep after ‘n’ numbers of lines in a large size file ?
For instance,
I have 1000 lines of code in which ‘wire’ occur before and after 451st line.
I want to grab the first occurrence of wire after 451st line .
You can use sed’s range expressions to perform this task easily. For example:
This will skip the first 451 lines, then scan each line until EOF for “wire.” When found, it will print the pattern space and then quit.