![]() |
GRASS Help System |
GRASS programs like r.report, r.coin, and s.menu output their results in the form of reports. Options made available in GRASS 5.0 allow the user added flexibility in designing the form of these reports.
Users can also use GRASS programs in combination with UNIX programs like "awk", "sed", and "sort" to completely customize the formats of reports.
One sample use of "awk" with GRASS programs appears in the Winter/1989 issue of the newsletter "GRASSClippings" (article by Fred Limp, Vol 3, No 1, pp 14-16). This script uses output from the r.stats program to calculate a region's expected total annual crop yield based on a raster map layer of estimated crop yield per soil type. It is reproduced below using GRASS 5.0 command syntax.
r.stats -aq soil.yield.map | \\awk '{sum+=$1*($2/100000)*2.47} END {print"Total Yield:",sum}'
When piping GRASS program outputs through other commands like "awk", users should include the option to run GRASS commands quietly (i.e., non-verbosely). Frequently, this will be a -q option.