I read lines of files to List
The contents of first file as follow:
2017-08-17 08:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:free] [end:0:]
2017-08-18 09:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:]
2017-08-19 010:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:not booking] [end:0:]
2017-08-10 11:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:free] [end:0:]
the contents of second file as follow:
2017-08-20 12:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:booking] [end:0:]
2017-08-21 13:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:]
2017-08-22 14:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:AA] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:130:free] [end:0:]
2017-08-23 15:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+BB] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:booking] [end:0:]
2017-08-24 16:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:AA] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:]
I use code in java to search in files and fetch each line has that values
This the first element of myList(its the contents of first file)
[
[
2017-08-17 08:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:free] [end:0:],
2017-08-18 09:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:],
2017-08-19 010:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:not booking] [end:0:],
2017-08-10 11:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:free] [end:0:]
],
and this the second element of myList(its the contents of second files)
[
2017-08-20 12:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:booking] [end:0:],
2017-08-21 13:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:BB] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:],
2017-08-22 14:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:AA] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:130:free] [end:0:],
2017-08-23 15:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+BB] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:booking] [end:0:],
2017-08-24 16:00:00 ready now [Contact:NO] [REF:123] [REF2:] [REF3:] [Name:AA] [Fam:bb] [TEMP:-2:0:-2:0:-2] [Resident:138:booking] [end:0:]
]
]
I tried now to extract helpful info using this Regex from answer by Wiktor Stribiżew
^\[?(\d[\d: -]+\d).*?\[Name:(\w*)].*?\[Fam:(\w*)].*?\[Resident:\w*:([^\]]*)]
How to implement this regex in java to get each info: {note: the list some times is larger of that}
the date and time
the name
the fam
the resident