I want to find the date range for each of the 4 CSV Files in a directory. The date column is the last column in each csv and is of the form 1/25/2012 7:20:55 PM
.
The date field is always the last column that is the 24th column. Only the records in each csv change. And the date is ordered.
Is there a way that I can do it for each of the files and get the final range, assuming that the dates are ordered?
So if my first record is 1/25/2012 7:20:55 PM and last record is 11/7/2016 2:36:20 PM.
I want the output date range as 1/25/2012 - 11/7/2016. But I want to club all the 4 files date range.
Example input (some columns omitted for brevity):
First file:
col1,col2,col3,...,col23,col24_time value1,value2,value3,...,value23,1/25/2012 7:20 PM value1,value2,value3,...,value23,1/26/2012 10:57 AM value1,value2,value3,...,value23,1/26/2012 2:20 PM value1,value2,value3,...,value23,1/30/2012 11:55 AM value1,value2,value3,...,value23,1/30/2012 3:17 PM value1,value2,value3,...,value23,1/30/2012 5:36 PM value1,value2,value3,...,value23,1/30/2012 8:16 PM ... value1,value2,value3,...,value23,4/11/2012 11:45 AM value1,value2,value3,...,value23,4/11/2012 2:23 PM
Intermediate files
Last file:
value1,value2,value3,...,value23,3/11/2015 4:45 AM value1,value2,value3,...,value23,3/11/2015 8:40 AM ... value1,value2,value3,...,value23,11/7/2016 2:36 PM
I have close to 5-10K records in each file. The dates are ordered within the files. And each file has an header for each column.
The output from the head -n7 Files/file1.csv | cut -d, -f24
command is:
"col24_time"
"2012-01-01 00:30:26"
"0"
"2012-01-01 02:00:37"
"0"
"0"
"https://external.xx.fbcdn.net/safe_image.php?" <<-- previous column record?