matching columns from different file & aggregating the values from particular coulmns using shell script -
Hello, I have more than one file that has the same lines but I want to match the data according to the date of the different data Am & amp; All files have output as a total of time and a few specific rows.
FILE 1
DATE TIME ABCD 20140402 00:15:26 21 50 30 60 20140402 00: 20:04 23 54 40 70 20140402 00:25:04 25 52 50 80 file 2
DATE TIME ABCD 20140402 00:15:21 40 60 60 70 20140402 00:20:29 50 61 70 80 20140402 00 : 25: 22 60 63 80 90 20140402 00:30:26 70 70 90 40 20140402 00:35:23 80 80 65 50 20140402 00:40:27 50 65 76 60 < Pre> DATE TIME ABCD 20140402 00:15:24 10 50 10 50 20140402 00:20:03 20 60 40 60 20140402 00:25:03 30 70 50 70 20140402 00:30:24 10 80 70 80 20140402 00 Output: DATE TIME BD 20140402 00:15 160 180 20140402 00:20 175 210 185 240 20140402 00:30 150 120 20140402 00:35 170 130 20140402 00:40 65 60
$ gawk / 2014 / {print $ 1 , Substrate ($ 2, 0, 5), $ 4, $ 6} '& lt; .txt | \ sort | \ Gawk '{b [$ 1 "" $ 2] + = $ 3; D [$ 1 "" $ 2] + = $ 4} END {to (in B)} {print, b [k], d [k]}} '| \ Sort 20140402 00:15 160 1800402 00:20 175 210 20140402 00:25 185 240 20140402 00:30 150 120 20140402 00:35 170 60 20140402 00:40 65 60 < / Html>
Comments
Post a Comment