Question
How to change old date format in a file to a new format
I have a huge file, and it has around 200 lines like this:
started at Wed Jun 5 08:45:01 PM +0330 2024 -- ended at Wed Jun 5 10:35:34 PM +0330 2024.
started at Thu Jun 6 01:30:01 AM +0330 2024 -- ended at Thu Jun 6 03:17:18 AM +0330 2024.
started at Thu Jun 6 07:30:01 AM +0330 2024 -- ended at Thu Jun 6 09:19:19 AM +0330 2024.
started at Thu Jun 6 01:30:01 PM +0330 2024 -- ended at Thu Jun 6 03:19:16 PM +0330 2024.
started at Thu Jun 6 07:30:01 PM +0330 2024 -- ended at Thu Jun 6 09:16:15 PM +0330 2024.
started at Fri Jun 7 01:30:01 AM +0330 2024 -- ended at Fri Jun 7 03:17:47 AM +0330 2024.
started at Fri Jun 7 07:30:01 AM +0330 2024 -- ended at Fri Jun 7 09:03:05 AM +0330 2024.
started at Fri Jun 7 01:30:01 PM +0330 2024 -- ended at Fri Jun 7 03:19:55 PM +0330 2024.
started at Fri Jun 7 07:30:01 PM +0330 2024 -- ended at Fri Jun 7 09:17:41 PM +0330 2024.
started at Sat Jun 8 01:30:01 AM +0330 2024 -- ended at Sat Jun 8 03:18:12 AM +0330 2024.
started at Sat Jun 8 07:30:01 AM +0330 2024 -- ended at Sat Jun 8 09:20:31 AM +0330 2024.
started at Sat Jun 8 01:30:01 PM +0330 2024 -- ended at Sat Jun 8 03:19:16 PM +0330 2024.
started at Sat Jun 8 07:30:01 PM +0330 2024 -- ended at Sat Jun 8 09:20:01 PM +0330 2024.
started at Sun Jun 9 01:30:01 AM +0330 2024 -- ended at Sun Jun 9 03:15:19 AM +0330 2024.
started at Sun Jun 9 07:30:01 AM +0330 2024 -- ended at Sun Jun 9 09:19:07 AM +0330 2024.
started at Sun Jun 9 01:30:01 PM +0330 2024 -- ended at Sun Jun 9 03:16:44 PM +0330 2024.
started at Sun Jun 9 07:30:01 PM +0330 2024 -- ended at Sun Jun 9 09:15:16 PM +0330 2024.
started at Mon Jun 10 01:30:01 AM +0330 2024 -- ended at Mon Jun 10 03:17:37 AM +0330 2024.
started at Mon Jun 10 07:30:01 AM +0330 2024 -- ended at Mon Jun 10 09:16:38 AM +0330 2024.
started at Mon Jun 10 01:30:01 PM +0330 2024 -- ended at Mon Jun 10 03:17:45 PM +0330 2024.
I changed the date format and after a while, it's like this:
started at Thu Jul 18 01:30:01 PM +0330 2024 -- ended at Thu Jul 18 05:48:36 PM +0330 2024.
started at Fri Jul 19 01:30:01 AM +0330 2024 -- ended at Fri Jul 19 04:47:38 AM +0330 2024.
started at Fri Jul 19 07:30:01 AM +0330 2024 -- ended at Fri Jul 19 10:43:25 AM +0330 2024.
started at Fri Jul 19 01:30:01 PM +0330 2024 -- ended at Fri Jul 19 05:51:24 PM +0330 2024.
started at 2024-07-19 19:30 -- ended at 2024-07-19 23:43.
started at 2024-07-20 01:30 -- ended at 2024-07-20 04:48.
started at 2024-07-20 07:30 -- ended at 2024-07-20 10:55.
I'm going to change the lines in the old format which is $(date)
's output to the new one $(date +%Y-%m-%d %H:%M)
.
How can I do that? is that even possible?
The old format date start from Jun 5 0:45:01 PM
to Fri Jul 19 05:51:24 PM
.