Kindly find the pig query below:
a = load '/home/edureka/airports_mod.dat' using PigStorage(',');
b = foreach a generate $1 as name, $3 as country;
c = group b by country;
d = foreach c generate group, COUNT(b.name);
Hope this resolves your query
In case of any further issue,feel free to revert.
Kindly give your valuable feedback by clicking on any one of the smiley's below.
Regards
Sumit Anand
edureka! Solution Team
Website - www.edureka.co
Edureka claims 1st position at Deloitte's Technology Fast 50 India 2014