[GRASS5] r.profile

Hamish hamish_nospam at yahoo.com
Wed Sep 28 01:02:35 EDT 2005


> after toying around with the enhanced version of r.profile (great job,
> Bob!) I wonder if there's an _elegant_ way to pipe any output from
> v.out.ascii into r.profile.  
>   
> This is trivial for vectors consisting of just one line, but for
> multi-line vectors manual editing is still needed.

I wouldn't call it elegant, but:

# lines to e1,n1,e2,n2[,...]
v.out.ascii multi_line format=standard | sed -e 1,10d | \
   grep -v ' 1 ' | tr '\n' ',' | sed -e 's/,L/\nL/g' | \
   cut -f2- -d',' | sed -e 's/^ //' | tr ' ' ',' | \
   sed -e 's/,$//' > ascii_lines.tmp

for LINE in `cat ascii_lines.tmp` ; do
   echo "$LINE" | r.profile -gc in=raster_map
done


I am sure awk would be prettier.


Hamish




More information about the grass-dev mailing list