I have the following output file created as a result of one script called pattern_daily.log
$ cat pattern_daily.log
Approved|2|Wed, Oct 24, 2012 11:21:09 AM
Declined|1|Wed, Oct 24, 2012 11:21:15 AM
Approved|2|Wed, Oct 24, 2012 11:24:08 AM
Declined|1|Wed, Oct 24, 2012 11:24:18 AM
Approved|2|Wed, Oct 24, 2012 11:25:41 AM
Declined|1|Wed, Oct 24, 2012 11:25:51 AM
Now, I want to sum the second column for each of the Approved and Declined patternfrom this pattern_daily.log file, I used below AWK command
awk -F "|" '{array[$1]+=$2} END { for (i in array) {print i"|" array}}' pattern_daily.log
Got below output:
Approved|6
Declined|3
But the desired output is:
Approved|6|DATE
Declined|3|DATE
Can someone help please? Perl or shell commands will also do, as I'm finding it difficult with AWK.
How you want to display dates???comma separated fields or just as a string "DATE". If string "DATE", then here you have it in red...but i guess its not