ciao to all

pay attention to spaces between column name in v.db.renamecol: no
spaces before and after comma.

Command substitution: backticks → $(....)  not substantial
differences; the second form is easier to read and write; it is also
nestable (we are all used to `    ` form, but $() is better (IMHO))

This should work (probably):

================================
db.columns test

key_column="cat"
suffix="_tmp"
for column in `db.columns test`; do
       if [ "$column" != "$key_column" ]; then
               tempcolumn=$(echo $column | awk '{print tolower($1)}')
               tempcolumn=$tempcolumn$suffix
               v.db.renamecol map=test layer=1 column=$column,$tempcolumn
               lower_column=$(echo $tempcolumn $suffix| awk '{print
substr($1,1,length($1)-length($2))}')
               v.db.renamecol map=test layer=1 column=$tempcolumn,$lower_column
       fi
done
db.columns test

===================

ciao

-- 
 Paolo
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to