Untitled
unknown
plain_text
3 years ago
784 B
6
Indexable
def update_last_index(syslog_record,last_line_no,i):
print("The function with update_last_index is getting called.")
vm_id=i
bookmark_index=last_line_no
print("VM ID :",vm_id)
bookmark_record=syslog_record
print(f"Bookmark Record for {i} is {bookmark_record}")
print(f"Updating Bookmark record for {bookmark_record}")
updated_bookmark_rec= str(bookmark_record) + str(bookmark_index)
print(updated_bookmark_rec)
with open(bookmark_file, 'r+') as file:
lines = file.readlines()
file.seek(0)
for line in lines:
if bookmark_record in line:
file.write(line.replace(bookmark_record, updated_bookmark_rec))
else:
file.write(line)
file.truncate()Editor is loading...