'Added simple AWK scripts;'
This commit is contained in:
parent
1cbfc80795
commit
289c9d8f7d
17
04_AWK/1.awk
Normal file
17
04_AWK/1.awk
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
BEGIN {
|
||||||
|
print "POCZATEK"
|
||||||
|
sum = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
country = $1;
|
||||||
|
if ($2 > 40)
|
||||||
|
print country, $2, NF
|
||||||
|
|
||||||
|
sum += $2;
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
print "KONIEC"
|
||||||
|
print "Sum of the 2nd columns is ", sum
|
||||||
|
}
|
16
04_AWK/2.awk
Normal file
16
04_AWK/2.awk
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
BEGIN {
|
||||||
|
sum = 0.0;
|
||||||
|
l = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
if ($2 > 40 && l > 0)
|
||||||
|
print "Country", $1, "has", $2, " mln of people, ", "nr of all columns=", NF
|
||||||
|
|
||||||
|
sum += $2;
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
print "Num of all people is", sum
|
||||||
|
}
|
17
04_AWK/3.awk
Normal file
17
04_AWK/3.awk
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
BEGIN {
|
||||||
|
sum = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pop = $2;
|
||||||
|
if ($2 > 40 && $2 < 4000) {
|
||||||
|
print $2, pop, NF;
|
||||||
|
print $2, pop, NF;
|
||||||
|
}
|
||||||
|
|
||||||
|
sum += pop;
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
print "Sum of all people is ", sum
|
||||||
|
}
|
@ -16,6 +16,6 @@ So, BH formes if the type was not 14 in column 17, but in the same line, in the
|
|||||||
|
|
||||||
New task
|
New task
|
||||||
|
|
||||||
4. Test, in which places all the mergers take place.
|
4. Test in which places all the mergers take place.
|
||||||
|
|
||||||
A merger is an even in which there non-zero value in inter** columns. If there some value in such a column it means that two or more stars merged together, creating a new object. The position in which it took place in star cluster is denoted with the column 'r1'. Compute a histogram for such events for any fiven timestep. Write everything into one file.
|
A merger is an even in which there non-zero value in inter** columns. If there some value in such a column it means that two or more stars merged together, creating a new object. The position in which it took place in star cluster is denoted with the column 'r1'. Compute a histogram for such events for any given timestep. Write everything into one file in order to plot it.
|
Loading…
Reference in New Issue
Block a user