I am not familiar with this data format but if there is not a package to read it automatically you could read it into a vector of lines using readlines and then parse it using regex.
Here is an example implementation where I copied your example into A.nets.
lines = readlines("A.nets")
isskipline(line) = startswith(line, "NetDegree")
readncols(line) = parse(Int, match(r"(?<=\: )\d+", line).match)
readcol(line) = parse(Int, match(r"(?<=\to)\d+", line).match)
function makerow(lines, index, ncols)
out = Vector{Int}(undef, ncols)
for (i, j) in enumerate(index:(index+ncols-1))
out[i] = readcol(lines[j])
end
return join(out, ' ')
end
function parsenets(lines)
index = 1
out = String[]
while index < length(lines)
if isskipline(lines[index])
ncols = readncols(lines[index])
index += 1
push!(out, makerow(lines, index, ncols))
index += ncols
else
index += 1
end
end
return out
end
parsenets(lines)
open("outfile.txt", "w") do io
for line in parsenets(lines)
print(io, line)
print(io, '\n')
end
end