Unix challenges

Have fun! Submit new challenges and solutions to old ones to unix@current_domain. You should replace current_domain with enpo.no :)

Challenge 3: Precision and timezone

2018-08-26 19:30:10 — Adrian Kjær Dalhaug
  • Remove milliseconds from timestamp (column 3).
  • Change from the timezone from -07:00 to UTC (column 2 and 3).
  • Zero pad the hour (column 3). Example: From 7:10:03 -> 07:10:03.

Data in ./input.txt.

Example input.txt


1,2017-10-01,20:29:53.000,24-73-E3-A6-7C-A5
2,2017-11-02,22:48:40.000,08-BC-C4-91-A2-B1
3,2018-07-28,13:08:03.000,55-53-56-70-93-A1
4,2018-06-14,1:54:51.000,EB-81-FD-8A-26-63
5,2018-07-22,22:35:19.000,28-15-35-79-92-DD

Example output


1,2017-10-02,03:29:53,24-73-E3-A6-7C-A5
2,2017-11-03,05:48:40,08-BC-C4-91-A2-B1
3,2018-07-28,20:08:03,55-53-56-70-93-A1
4,2018-06-14,08:54:51,EB-81-FD-8A-26-63
5,2018-07-23,05:35:19,28-15-35-79-92-DD