I have 2 CSV files which look like follows:
col1,col2,col3,col4,date,time,col7 1,2,3,4,2019-07-20,12:40:00,0 1,2,3,4,2019-07-20,12:43:00,0 1,2,3,4,2019-07-20,12:44:00,0 1,2,3,4,2019-07-20,12:45:00,0 1,2,3,4,2019-07-20,12:46:00,0 1,2,3,4,2019-07-20,12:47:00,0
date,time,col3 2019-07-20,12:40:00,1 2019-07-20,12:41:00,2 2019-07-20,12:42:00,3 2019-07-20,12:43:00,4 2019-07-20,12:44:00,5 2019-07-20,12:45:00,6 2019-07-20,12:46:00,7 2019-07-20,12:47:00,8
As one can see in
file2.csv, for for rows 2 and 3 with timestamps
2019-07-20,12:42:00 respectively, no corresponding rows exist with the same timestamp in
file1.csv. I would like to output
file2.csv with those specific rows removed so that only rows with matching timestamps in
file1.csv will remain.
Is it possible to perform this with a simple command in command line? I have a hunch it might involve regex matching but I am not sure about the most efficient way to perform this operation.