How can I cut specific text from a python file (around 150 000 000 lines)? I mean that program has to find one word and ending word and cut it what is between these lines. I was trying something like that:
with bz2.BZ2File(file, 'r','utf-8') as f:
for line in f:
counter += 1
if line.strip() == '<title>Viriato da Cruz</title>': #or whatever title you need
break
elif counter > 1000:
break
print('bla')
for line in f:
counter += 1
if line.strip() == '</text>' :
break
print(line)