I have a large pipe delimited file with approx. 2.3 million rows (records).
I am attempting to locate a particular record. However I do not have any information regarding the record of interest but I believe that I have information about a record that may be close to it. So essentially I want to look for the record that I know about, once string is found, I'd like it to write the contents of that line plus a specified number of lines that follows the found string to see if I can identify my missing record.
How can I be looking for a record I don't know about? It is based on counts. I am missing a single record and based on what was inserted into a database I have pointed the last record that was inserted and I believe the record that is missing should have been inserted after that.
The record that I have information on commences with the following:
D|12345678
The numeric is a unique number. So I want to be able to get the row where this text appears, output the entire line and print an additional say 3 - 10 lines (or how many lines I desire after) to see if I can locate the missing record.
I have been reading about grep, sed, awk and I am at a total loss how to implement. I do not want to have to open such a large file and scan to this location in order to find my record.
Any help would be greatly appreciated.
Our community of experts have been thoroughly vetted for their expertise and industry experience.