Here’s an overview of my file :
[2020/06/18 17:19:25] Window closed --> OptionDialog = 'Waiting Dialog - Session restore' --> frame = 'DataManager'
[2020/06/18 17:19:40] Window opened --> frame = 'DataManager'
[2020/06/18 17:19:40] MB1 --> Menu item = [Toolbox] --> frame = 'DataManager'
[2020/06/18 17:19:42] MB1 --> Menu item = [2G&R Synthesis toolbox, Toolbox] --> Popup Menu --> frame = 'DataManager'
[2020/06/18 17:19:42] Window opened --> frame = 'ToolBox'
[2020/06/18 17:19:42] Window gained focus --> frame = 'ToolBox'
I would like to retrieve only the lines with the substring “Window” just after the dates and then write them in a new text file. Here's what I have done so far :
file = open("Test2.txt") do file
f = readlines(file)
for line in f
if line[23:28]== "Window"
open("t.txt","w") do file
write(file,line)
end
end
end
end
My problem is that only the last line containing "Window" from the first file is written to the new file. For exemple here it would be :
[2020/06/18 17:19:42] Window gained focus --> frame = 'ToolBox'
How do I make sure that ALL the lines containing "Window" are written to the new file?
Thank you in advance for your answers,
Valentine