This is my input file :
# cat list 20130430121600, cucm, location,76,2 20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,80,8 20130430122000,cucm1,location1,90,8 20130430140000,cucm1,location1,87,11 20130430140000, cucm,location,67,9
This is the required output
20130430121600, cucm, location,76,2 20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,4,8 20130430122000,cucm1,location1,14,8 20130430140000,cucm1,location1,87,11 20130430140000, cucm,location,67,9
Requirements :
The first column represents YYYYMMDDHHMISS - the date along with the time . The first row, first column represents 2013 year Apr 30 12th hour and 16 min.
I should take delta of 4th column between consecutive rows when 2nd and 3rd column matches, and also the difference between the 1st column is not more than 1 hour
In my list file, first and third row matches in 2nd and 3rd column, and also the difference between the time column is not more than 1 hour, and so I take a diff of the fourth column : 80 -76 =4.
This gave me a solution without the timestamp column.
Can some one help me out.
Thanks in Advance
---------- Post updated at 04:07 AM ---------- Previous update was at 04:02 AM ----------
Sending it again, as the csv file was not proper.
This is my input file :
20130430121600,cucm,location,76,2
20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,80,8 20130430122000,cucm1,location1,90,8 20130430140000,cucm1,location1,87,11
20130430140000,cucm,location,67,9
This is the required output
20130430121600,cucm,location,76,2
20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,4,8 20130430122000,cucm1,location1,14,8 20130430140000,cucm1,location1,87,11
20130430140000,cucm,location,67,9
Requirements :
The first column represents YYYYMMDDHHMISS - the date along with the time . The first row, first column represents 2013 year Apr 30 12th hour and 16 min.
I should take delta of 4th column between consecutive rows when 2nd and 3rd column matches, and also the difference between the 1st column is not more than 1 hour
In my list file, first and third row matches in 2nd and 3rd column, and also the difference between the time column is not more than 1 hour, and so I take a diff of the fourth column : 80 -76 =4.
http://www.unix.com/shell-programmin...#post302794979
This gave me a solution without the timestamp column.
Can some one help me out.
Thanks in Advance