binary file search and extract

I have thousand binary files in a remote server. with a lot of information in each of them. every thousands file is in a zip folder.
I should go to each file and extract special parts:
In each file after string "NW RM" there are a lot of numerous data. after 5 lines I require the 2 lines data and I should pass the next 2 lines and look for the next 2 lines which again will be after 5 lines. I look for to see any non-zero values in thoes 2 lines to store them. each line in a separate array.

a sample of my data:
128 0 0 0 123 0 116 129 130 129 0 0 0 128 0 0 0 123 0 116 129 130 129 0 0 0
NW RM:
257 975
104.1500
400.0000
167 0 0 128 0 120 137 0 0 0 0 0 0 0 0 0 0
88 0 0 0 0 132 123 0 0 0 0 0 0 0 0 124 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <---the first line that I want
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <---the second line that I want
132 0 0 0 0 0 0 162 120 118 130 118 0 118 0 0 0
0 130 0 0 0 0 0 120 148 121 134 123 167 110 0 0 0
22 431
223039672
0
167 0 0 128 0 120 137 0 0 0 0 0 0 0 0 0 0
88 0 0 0 0 132 123 0 0 0 0 0 0 0 0 124 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <---Agian the first line that I want
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <---Again the second line that I want
132 0 0 0 0 0 0 162 120 118 130 118 0 118 0 0 0
0 130 0 0 0 0 0 120 148 121 134 123 167 110 0 0 0
0 0 129 0 0 0 0 126 0 142 132 125 124 157 142 142 142
.....it continues in this pattern

If anyone could help, I have some questions about it, and I really appreciate your response in advance:
1-As the size of each file is high(about 700MB), should I copy the whole content of each file to analyze it? Or I can one by one go and only grab those parts that I want and store them in 2 arrays.
2-I write a program to go and find the "NW RM" but How I can say pass lines or should I say pass characters?

thank you in advance
http://www.cplusplus.com/reference/istream/basic_istream/seekg/


> How I can say pass lines or should I say pass characters?
I thought you said you had binary files. There should be set positions for each field.
Topic archived. No new replies allowed.