Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Add numbers in third code with conditions on the 1st and 2nd Post 302883355 by ctsgnb on Monday 13th of January 2014 12:13:50 PM
Old 01-13-2014
Quote:
Originally Posted by matrixmadhan
awk '{ if ( $1 > $2 ) { arr[$2$1] += $3 } else { arr[$1$2] += $3 } }END{ for (i in arr) { print i, arr[i] } }' file
$1 and $2 will be concatenated in the output when you print i which may not be a "userfriendly" output
 

We Also Found This Discussion For You

1. UNIX for Dummies Questions & Answers

Want the UNIX code - I want to sum of the 1st column wherever the first 2nd and 3rd columns r equal

I have the code for the below things.. File1 has the content as below 8859 0 subscriberCreate 18 0 subscriberPaymentMethodChange 1650 0 subscriberProfileUpdate 7668 0 subscriberStatusChange 13 4020100 subscriberProfileUpdate 1 4020129 subscriberStatusChange 2 4020307 subscriberCreate 8831... (5 Replies)
Discussion started by: Mahen
5 Replies
GIT-COLUMN(1)							    Git Manual							     GIT-COLUMN(1)

NAME
git-column - Display data in columns SYNOPSIS
git column [--command=<name>] [--[raw-]mode=<mode>] [--width=<width>] [--indent=<string>] [--nl=<string>] [--padding=<n>] DESCRIPTION
This command formats its input into multiple columns. OPTIONS
--command=<name> Look up layout mode using configuration variable column.<name> and column.ui. --mode=<mode> Specify layout mode. See configuration variable column.ui for option syntax. --raw-mode=<n> Same as --mode but take mode encoded as a number. This is mainly used by other commands that have already parsed layout mode. --width=<width> Specify the terminal width. By default git column will detect the terminal width, or fall back to 80 if it is unable to do so. --indent=<string> String to be printed at the beginning of each line. --nl=<N> String to be printed at the end of each line, including newline character. --padding=<N> The number of spaces between columns. One space by default. AUTHOR
Written by Nguyen Thai Ngoc Duy <pclouds@gmail.com[1]> GIT
Part of the git(1) suite NOTES
1. pclouds@gmail.com mailto:pclouds@gmail.com Git 1.8.5.3 01/14/2014 GIT-COLUMN(1)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy