You're looking for Skip
. This does not check for an EndOfFile
condition, and should use something like BlockStream
BlockStream
to handle aborts, but the following should work:
strm = OpenRead["filename"];
(* Repeat the following until done *)
Skip[strm, String, A];
AppendTo[ results, Read[strm, String]]
(*
String just gets the entire line. If the number of elements is
constant for each row, then it can be replaced in the Read by
ConstantArray[String, numels]~Join~{String}.
*)
Skip[strm, String, B - 2];
AppendTo[ results, Read[strm, String]]
(* close the stream *)
Close[ strm ];