Mögliche Lösung

BEGIN { 
  print "Feststoff\tQ/(V * deltaT)\t"
  print "--------------------------------------"
  OFS="\t\t" 
} 

$2 ~ /^[0-9]/ {
  val = $2 * $3 
  
  if(val <= 2.0)
    print $1, val, "<= 2.0"
  else
    print $1, val, ">  2.0"
}

Ausgabe:

Feststoff       Q/(V * deltaT)
--------------------------------------
Al              2.484           >  2.0
Pb              1.4742          <= 2.0
Cr              3.6669          >  2.0
Fe              3.6989          >  2.0
Mg              1.7922          <= 2.0
Ti              2.1338          >  2.0
Bi              1.274           <= 2.0


Hinweis: Sollte das Skript nicht das erwartete Ergebnis generieren, dann ist möglicherweise die konkrete Systemeinstellung (Dezimalpunkt vs. Dezimalkomma) der Grund dafür. Genauer ist diese Problematik inkl. Abhilfemaßnahme bei Lösung zu Aufgabe 100 beschrieben.


zurück

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.