'Added scripts to AWK'
This commit is contained in:
parent
289c9d8f7d
commit
dc24ee47b2
16
04_AWK/4.awk
Normal file
16
04_AWK/4.awk
Normal file
@ -0,0 +1,16 @@
|
||||
BEGIN {
|
||||
sum = 0.0;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
if ($2 > 40) {
|
||||
print $1;
|
||||
}
|
||||
|
||||
sum += $2;
|
||||
}
|
||||
|
||||
END {
|
||||
print "sum of population", sum;
|
||||
}
|
18
04_AWK/5.awk
Normal file
18
04_AWK/5.awk
Normal file
@ -0,0 +1,18 @@
|
||||
BEGIN {
|
||||
sum = 0.0;
|
||||
}
|
||||
|
||||
{
|
||||
if ($1 != "#") {
|
||||
sum += $2;
|
||||
if ($2 > 40.0) {
|
||||
print "Country ", $1, "has", $2, "mln people";
|
||||
}
|
||||
}
|
||||
|
||||
print "Nr of columns", NF;
|
||||
}
|
||||
|
||||
END {
|
||||
print "Total population ", sum;
|
||||
}
|
Loading…
Reference in New Issue
Block a user