*** empty log message ***
This commit is contained in:
parent
9147dd9e29
commit
7b5eddbc8d
2
ase/test/awk/cou-023.awk
Normal file
2
ase/test/awk/cou-023.awk
Normal file
@ -0,0 +1,2 @@
|
||||
BEGIN { FS = OFS = "\t"; }
|
||||
{ $5 = 1000 * $3 / $2; print; }
|
20
ase/test/awk/cou-023.out
Normal file
20
ase/test/awk/cou-023.out
Normal file
@ -0,0 +1,20 @@
|
||||
BEGIN {
|
||||
__global7 = __global13 = " ";
|
||||
}
|
||||
|
||||
{
|
||||
$5 = ((1000 * $3) / $2);
|
||||
print;
|
||||
}
|
||||
|
||||
USSR 8649 275 Asia 31.7956
|
||||
Canada 3852 25 North America 6.49013
|
||||
China 3705 1032 Asia 278.543
|
||||
USA 3615 237 North America 65.5602
|
||||
Brazil 3286 134 South America 40.7791
|
||||
India 1267 746 Asia 588.792
|
||||
Mexico 762 78 North America 102.362
|
||||
France 211 55 Europe 260.664
|
||||
Japan 144 120 Asia 833.333
|
||||
Germany 96 61 Europe 635.417
|
||||
England 94 56 Europe 595.745
|
4
ase/test/awk/cou-024.awk
Normal file
4
ase/test/awk/cou-024.awk
Normal file
@ -0,0 +1,4 @@
|
||||
$4 == "Asia" { pop = pop + $3; n = n + 1; }
|
||||
END { print "Total population of the", n,
|
||||
"Asian countries is", pop, "million.";
|
||||
}
|
9
ase/test/awk/cou-024.out
Normal file
9
ase/test/awk/cou-024.out
Normal file
@ -0,0 +1,9 @@
|
||||
($4 == "Asia") {
|
||||
pop = (pop + $3);
|
||||
n = (n + 1);
|
||||
}
|
||||
|
||||
END {
|
||||
print "Total population of the",n,"Asian countries is",pop,"million.";
|
||||
}
|
||||
Total population of the 4 Asian countries is 2173 million.
|
6
ase/test/awk/cou-025.awk
Normal file
6
ase/test/awk/cou-025.awk
Normal file
@ -0,0 +1,6 @@
|
||||
/Asia/ { pop["Asia"] += $3; }
|
||||
/Europe/ { pop["Europe"] += $3; }
|
||||
END { print "Asian population is", pop["Asia"], "million.";
|
||||
print "European population is", pop["Europe"], "million.";
|
||||
}
|
||||
|
14
ase/test/awk/cou-025.out
Normal file
14
ase/test/awk/cou-025.out
Normal file
@ -0,0 +1,14 @@
|
||||
/Asia/ {
|
||||
pop["Asia"] += $3;
|
||||
}
|
||||
|
||||
/Europe/ {
|
||||
pop["Europe"] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
print "Asian population is",pop["Asia"],"million.";
|
||||
print "European population is",pop["Europe"],"million.";
|
||||
}
|
||||
Asian population is 2173 million.
|
||||
European population is 172 million.
|
3
ase/test/awk/cou-026.awk
Normal file
3
ase/test/awk/cou-026.awk
Normal file
@ -0,0 +1,3 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
{ pop[$4] += $3; }
|
||||
END { for (name in pop) print name, pop[name]; }
|
16
ase/test/awk/cou-026.out
Normal file
16
ase/test/awk/cou-026.out
Normal file
@ -0,0 +1,16 @@
|
||||
BEGIN {
|
||||
__global7 = " ";
|
||||
}
|
||||
|
||||
{
|
||||
pop[$4] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
for (name in pop)
|
||||
print name,pop[name];
|
||||
}
|
||||
Europe 172
|
||||
South America 134
|
||||
North America 340
|
||||
Asia 2173
|
5
ase/test/awk/cou-027.awk
Normal file
5
ase/test/awk/cou-027.awk
Normal file
@ -0,0 +1,5 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
{ pop[$4] += $3; }
|
||||
END { for (c in pop)
|
||||
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' +1rn";
|
||||
}
|
16
ase/test/awk/cou-027.out
Normal file
16
ase/test/awk/cou-027.out
Normal file
@ -0,0 +1,16 @@
|
||||
BEGIN {
|
||||
__global7 = " ";
|
||||
}
|
||||
|
||||
{
|
||||
pop[$4] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
for (c in pop)
|
||||
printf ("%15s %6d\n",c,pop[c]) | "sort -t' ' +1rn";
|
||||
}
|
||||
Asia 2173
|
||||
North America 340
|
||||
Europe 172
|
||||
South America 134
|
23
ase/test/awk/crash08.awk
Normal file
23
ase/test/awk/crash08.awk
Normal file
@ -0,0 +1,23 @@
|
||||
function a()
|
||||
{
|
||||
print "aaaa";
|
||||
a();
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
a = (b = 20);
|
||||
print a; print b; for(i=j=1; i< 10; i++) print i, j;
|
||||
|
||||
a += b += 20;
|
||||
print a; print b; for(i=j=1; i< 10; i++) print i, j;
|
||||
|
||||
j = (a < 20)? k = 20: c = 30;
|
||||
print (a < 20)? k = 20: c = 30;
|
||||
print "j=" j;
|
||||
print "k=" k;
|
||||
print "c=" c;
|
||||
|
||||
a();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user