thesis/clean_bib.py

22 lines
537 B
Python
Raw Normal View History

2024-05-30 19:53:24 +02:00
#!/usr/bin/env python3
f='bibliography.bib'
indexes=[]
flag = False
with open(f) as fh:
for line in fh.readlines():
if flag is True:
print(line.rstrip())
if line[0] == '}':
flag = False
if line[0] == '@':
index = line[line.find('{')+1:line.find(',')]
if index.strip() in indexes:
continue
else:
indexes.append(index.strip())
flag = True
print(line.rstrip())