Unix awk script
Hi, I am stuck on this problem if anyone can help
Write awk.script that calculates which continent (Europe, Asia or America) has the largest population density based on the given input. America corresponds to two areas in the file, North and South. The script also produces the following output:
[FONT=Courier New, monospace]Based on [/FONT][FONT=Courier New, monospace]countries.txt[/FONT][FONT=Courier New, monospace],[/FONT][FONT=Courier New, monospace][/FONT][FONT=Courier New, monospace]continent with the largest population density is[/FONT]
[FONT=Courier New, monospace]Asia[/FONT][FONT=Courier New, monospace]: population density = [/FONT][FONT=Courier New, monospace]866[/FONT][FONT=Courier New, monospace]/[/FONT][FONT=Courier New, monospace]1411 [/FONT][FONT=Courier New, monospace]=[/FONT][FONT=Courier New, monospace] 0.6137[/FONT]
Information in blue color was calculated based on the following countries.txt file (format is
country square population area):
[FONT=Courier New, monospace]Canada 3852 25 North[/FONT]
[FONT=Courier New, monospace]USA 3615 237 North[/FONT]
[FONT=Courier New, monospace]Brazil 3286 134 South[/FONT]
[FONT=Courier New, monospace]India 1267 746 Asia[/FONT]
[FONT=Courier New, monospace]Mexico 762 78 North[/FONT]
[FONT=Courier New, monospace]France 211 55 Europe[/FONT]
[FONT=Courier New, monospace]Japan 144 120 Asia[/FONT]
[FONT=Courier New, monospace]Germany 96 61 Europe[/FONT]
[FONT=Courier New, monospace]England 94 56 Europe[/FONT]
Write awk.script that calculates which continent (Europe, Asia or America) has the largest population density based on the given input. America corresponds to two areas in the file, North and South. The script also produces the following output:
[FONT=Courier New, monospace]Based on [/FONT][FONT=Courier New, monospace]countries.txt[/FONT][FONT=Courier New, monospace],[/FONT][FONT=Courier New, monospace][/FONT][FONT=Courier New, monospace]continent with the largest population density is[/FONT]
[FONT=Courier New, monospace]Asia[/FONT][FONT=Courier New, monospace]: population density = [/FONT][FONT=Courier New, monospace]866[/FONT][FONT=Courier New, monospace]/[/FONT][FONT=Courier New, monospace]1411 [/FONT][FONT=Courier New, monospace]=[/FONT][FONT=Courier New, monospace] 0.6137[/FONT]
Information in blue color was calculated based on the following countries.txt file (format is
country square population area):
[FONT=Courier New, monospace]Canada 3852 25 North[/FONT]
[FONT=Courier New, monospace]USA 3615 237 North[/FONT]
[FONT=Courier New, monospace]Brazil 3286 134 South[/FONT]
[FONT=Courier New, monospace]India 1267 746 Asia[/FONT]
[FONT=Courier New, monospace]Mexico 762 78 North[/FONT]
[FONT=Courier New, monospace]France 211 55 Europe[/FONT]
[FONT=Courier New, monospace]Japan 144 120 Asia[/FONT]
[FONT=Courier New, monospace]Germany 96 61 Europe[/FONT]
[FONT=Courier New, monospace]England 94 56 Europe[/FONT]
0