[GRASS-user] convert r.report output to spreadsheet format
Daniel Victoria
daniel.victoria at gmail.com
Thu Feb 26 07:34:19 EST 2009
Just save this as a .csv or .txt and open in any spreadsheet software,
stating that the field delimiter is |
Then just do some column copy/paste and you are done. No need for awk
black-magic
Daniel
On Wed, Feb 25, 2009 at 3:51 AM, maning sambale
<emmanuel.sambale at gmail.com> wrote:
> Thanks!
> An example of the r.report output:
> |-----------------------------------------------------------------------------|
> | Category Information | | cell| % |
> | #|description | hectares| count| cover|
> |-----------------------------------------------------------------------------|
> | 1|Siquijor | 31,313| 385511| 0.05|
> | |----------------------------------------------|----------|---------|------|
> | |112|Broadleaf - open canopy. . . . . . . . . .| 8265| 101755| 26.39|
> | |140|Mangrove . . . . . . . . . . . . . . . . .| 173| 2125| 0.55|
> | |210|Agriculture-annual . . . . . . . . . . . .| 7370| 90737| 23.54|
> | |310|Scrub. . . . . . . . . . . . . . . . . . .| 1063| 13081| 3.39|
> | |320|Grassland. . . . . . . . . . . . . . . . .| 7185| 88460| 22.95|
> | |400|Built-up . . . . . . . . . . . . . . . . .| 103| 1270| 0.33|
> | |510|Inland water . . . . . . . . . . . . . . .| 44| 539| 0.14|
> | | *|no data. . . . . . . . . . . . . . . . . .| 7111| 87544| 22.71|
>
> I want converted to:
> Province,land_cover_code,description,hectares,cell_count,percent_cover
>
> I will try the cryptic awk lines.
>
>
> On Wed, Feb 25, 2009 at 12:12 AM, Giovanni Pasini <jynxtor at gmail.com> wrote:
>> maning sambale ha scritto:
>>>
>>> Hi,
>>>
>>> Looking for tips in "transforming" r.report output into a
>>> "spreadsheet" like format.
>>>
>>
>> Hi,
>> I use awk (change NF and the other fields $*):
>>
>> r.report -n map=gri_1000_in,dem2_idw_100_slope_rec units=h,p,c | awk 'BEGIN
>> {FS="|";OFS="|"} !/---/ && NF==7 {intest=$2} NF==8 {sub(/[ .]*$/,"",$4);
>> print intest, $4, $6}' > report_slope.txt
>>
>> This from a non awk expert!
>>
>> cheers,
>> giovanni
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>
>
>
> --
> cheers,
> maning
> ------------------------------------------------------
> "Freedom is still the most radical idea of all" -N.Branden
> wiki: http://esambale.wikispaces.com/
> blog: http://epsg4253.wordpress.com/
> ------------------------------------------------------
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
More information about the grass-user
mailing list