Skip to main content
3 of 3
Tried to clarify; improved capitalization, punctuation and wording; added tag.

Comparing dates of different formats and matching it from another file

I have two data files with date stamps in different formats (as text in the file contents).  I wish to compare the two dates and print the variable from one file to another according to date in a shell script.  I have a script in MATLAB, but I’d like to do it in a shell script.  In one file, the date format is 2017-01-01 12:00:00. In the other file it is 20170101 1200. For a variable I want to compare it with date in file1 and if it matches print variable as column in file1 from file2.