Is there any way, how to parse line which contains date in some format and value? I'm looking for general solution. I'm writing script, which should validate string. My input is some string and time format. For example:
in first file and known time format
[10:17:21 20.04.1911] 890.584
[%H:%M:%S %d.%m.%Y]
in second file and known time format
10:17:21-20.04.1911 890.584
%H:%M:%S-%d.%m.%Y
in third file and known time format
(20-04-1911) 890.584
(%d-%m-%Y)
in fourth file and known time format
20-04-1911 10:17:21 890.584
%d-%m-%Y %H:%M:%S
etc.
I already have function to get timestamp from date according to time format, but I don't know, how to parse date from that line.
Any ideas? Thanks.