I have an array called @mytitles
which contains a lot of titles such as, say, title1
, title2
and so on. I have a file called "Superdataset
" which has information pertaining to each title. However, the info related to title1
may be of 6 lines while the info for title2
may be 30 lines (its random). Each piece of information (for a titlex
) starts with "Reading titlex
" and ends with "Done reading titlex
".
From these lines of information of each title, I need to extract some data. I think its lucky that this data I need is in the 2 lines just before "Done reading titlex
" each time
So my "Superdataset
" looks like:
Reading title1 random info line1 random info line2 random info line3 random info line4 random info line5 my earnings are 6000 my expenses are 1000 Done reading title1 Reading title2 random info line6 random info line7 random info line8 random info line9 random info line10 random info line11 random info line12 random info line13 random info line14 my earnings are 11000 my expenses are 9000 Done reading title2
I need a total sum of expenses and a total sum of earnings. Any suggestions?
PS-the array has complicated names, not something as simple as titlex