I am trying a read a file that's arranged such that there's alternating set of rows containing data that I don't need and data that I need. So for my case the first n lines in the files are useless to me while the next m lines are data I need, and the next n lines are useless etc. Here is a sample.
TER
ENDMDL
REMARK GENERATED BY TRJCONV
TITLE Neat THF t= 6.00000
REMARK THIS IS A SIMULATION BOX
CRYST1 32.503 32.503 32.503 90.00 90.00 90.00 P 1 1
MODEL 16
ATOM 1 O1 THF 1 19.380 32.070 27.250 1.00 0.00
ATOM 2 CA1 THF 1 19.090 30.880 26.540 1.00 0.00
ATOM 3 CA2 THF 1 19.460 33.170 26.380 1.00 0.00
ATOM 4 CB1 THF 1 18.940 31.200 25.060 1.00 0.00
ATOM 5 CB2 THF 1 19.190 32.710 24.950 1.00 0.00
ATOM 6 T21 THF 1 18.950 30.900 25.460 1.00 0.00
ATOM 7 T22 THF 1 19.290 33.050 25.300 1.00 0.00
ATOM 8 O1 THF 2 31.020 24.150 7.910 1.00 0.00
ATOM 9 CA1 THF 2 31.310 24.450 9.250 1.00 0.00
ATOM 10 CA2 THF 2 31.450 22.850 7.570 1.00 0.00
ATOM 11 CB1 THF 2 32.010 23.250 9.900 1.00 0.00
ATOM 12 CB2 THF 2 32.100 22.200 8.790 1.00 0.00
ATOM 13 T21 THF 2 31.810 23.710 9.890 1.00 0.00
ATOM 14 T22 THF 2 31.950 22.220 8.310 1.00 0.00
TER
ENDMDL
REMARK GENERATED BY TRJCONV
TITLE Neat THF t= 6.00000
REMARK THIS IS A SIMULATION BOX
CRYST1 32.503 32.503 32.503 90.00 90.00 90.00 P 1 1
MODEL 16
ATOM 1 O1 THF 1 19.380 32.070 27.250 1.00 0.00
ATOM 2 CA1 THF 1 19.090 30.880 26.540 1.00 0.00
ATOM 3 CA2 THF 1 19.460 33.170 26.380 1.00 0.00
ATOM 4 CB1 THF 1 18.940 31.200 25.060 1.00 0.00
ATOM 5 CB2 THF 1 19.190 32.710 24.950 1.00 0.00
ATOM 6 T21 THF 1 18.950 30.900 25.460 1.00 0.00
ATOM 7 T22 THF 1 19.290 33.050 25.300 1.00 0.00
ATOM 8 O1 THF 2 31.020 24.150 7.910 1.00 0.00
ATOM 9 CA1 THF 2 31.310 24.450 9.250 1.00 0.00
ATOM 10 CA2 THF 2 31.450 22.850 7.570 1.00 0.00
ATOM 11 CB1 THF 2 32.010 23.250 9.900 1.00 0.00
ATOM 12 CB2 THF 2 32.100 22.200 8.790 1.00 0.00
ATOM 13 T21 THF 2 31.810 23.710 9.890 1.00 0.00
ATOM 14 T22 THF 2 31.950 22.220 8.310 1.00 0.00
so in this case the first 7 lines are data I don't need while the next 14 lines are important data I want to read. I know I can combine Skip and Readlist
str = OpenRead["file"];
Skip[str, String, 7]; coord = ReadList[str, {Word, Number, Word, Word}~Join~Table[Number, {6}], 14]
How can I do this repeatedly to read say 500 such data (i.e. ATOM 1 - 14, 500 times). I will like to write a function that can accept the number of such data I want to read.
This entry is related but not exactly what I want. If there's already a similar question I'll be more than happy to delete this but I couldn't find any that suits my purpose. Please note that these files are really huge ~1GB.



FindList? – Xerxes Mar 7 at 0:51