Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Add numbers in third code with conditions on the 1st and 2nd Post 302883306 by TheTransporter on Monday 13th of January 2014 08:40:31 AM
Old 01-13-2014
Add numbers in third code with conditions on the 1st and 2nd

Hello all,

I have a file with three columns, in which the first column has one letter from A-Z, the second one letter from A-Z, and the third a number:
e.g.
Code:
A A 5
A B 6
A C 1
A D 7
B A 8

The desired output is:
Code:
A A 5
A B 14
A C 1
A D 7

Just because A B and B A are essentially the same.

Is there a way to do this in awk or bash?

Thank you

Last edited by vbe; 01-13-2014 at 09:48 AM.. Reason: code tags...
 

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
GEOIP_COUNTRY_CODE3_BY_NAME(3)						 1					    GEOIP_COUNTRY_CODE3_BY_NAME(3)

geoip_country_code3_by_name - Get the three letter country code

SYNOPSIS
string geoip_country_code3_by_name (string $hostname) DESCRIPTION
The geoip_country_code3_by_name(3) function will return the three letter country code corresponding to a hostname or an IP address. PARAMETERS
o $hostname - The hostname or IP address whose location is to be looked-up. RETURN VALUES
Returns the three letter country code on success, or FALSE if the address cannot be found in the database. EXAMPLES
Example #1 A geoip_country_code3_by_name(3) example This will print where the host example.com is located. <?php $country = geoip_country_code3_by_name('www.example.com'); if ($country) { echo 'This host is located in: ' . $country; } ?> The above example will output: This host is located in: USA SEE ALSO
geoip_country_code_by_name(3), geoip_country_name_by_name(3). PHP Documentation Group GEOIP_COUNTRY_CODE3_BY_NAME(3)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy