I have the following long file
2012-01-30 12:41:06,214 app10 device INFO [2012-01-30 12:40:46,214] info1 info2 info3 ...
this is come from remote offline devices and it means if teh device's time (2nd time) setting are not correct it points to the future. If the 2nd time is points to the future, I would like to change it to the 1st date. If this is the same or in the past, I would like to leave it as is. Only the date is important, the time is not needed at all. After the 2nd time we have several data and sometimes different number of columns we would like to keep.
example:
2012-01-30 12:41:06,214 app10 device INFO [2013-01-30 12:40:46,214] info1 info2 info3 ...
should be
2012-01-30 app10 device INFO 2012-01-30 info1 info2 info3 ...
we would like to run this from a script, so I prefer bash, sed, awk or perl solution. thank you for your help