5.13 Exercises

  1. Rewrite the program:
    awk 'BEGIN { print "Month Crates"
                 print "----- ------" }
               { print $1, "     ", $2 }' inventory-shipped
    

    from Output Separators, by using a new value of OFS.

  2. Use the printf statement to line up the headings and table data for the inventory-shipped example that was covered in The print Statement.
  3. What happens if you forget the double quotes when redirecting output, as follows:
    BEGIN { print "Serious error detected!" > /dev/stderr }