Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/awk -f
- # Fahrenheit = Fahrenheit = 32 + Celsius X 1.8
- # Celsius = (Fahrenheit - 32) / 1.8
- BEGIN{
- print "Begin line with F or C, to convert to Celsius, or Fahrenheit."
- }
- END{
- }
- /^[Ff].* /{
- #print "Fahrenheit to Celsius"
- print (($2 - 32) / 1.8 ) " C"
- }
- /^[Cc].* /{
- #print "Celsius to Fahrenheit"
- print ( 32 + ( $2 * 1.8 )) " F"
- }
- # 4 / 5 = 1.8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement