[GRASS-SVN] r40310 - in grass/branches/develbranch_6/scripts:
d.vect.thematic v.db.addcol v.db.addtable v.db.dropcol
v.db.droptable v.db.renamecol v.db.update v.dissolve
v.rast.stats v.report
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 8 00:44:03 EST 2010
Author: hamish
Date: 2010-01-08 00:44:02 -0500 (Fri, 08 Jan 2010)
New Revision: 40310
Modified:
grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic
grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol
grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol
grass/branches/develbranch_6/scripts/v.db.droptable/v.db.droptable
grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
grass/branches/develbranch_6/scripts/v.db.update/v.db.update
grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
grass/branches/develbranch_6/scripts/v.report/v.report
Log:
stricter grep search
Modified: grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic
===================================================================
--- grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic 2010-01-08 05:44:02 UTC (rev 40310)
@@ -361,9 +361,9 @@
export GRASS_PNG_AUTO_WRITE
fi
-table=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $2}'`
-database=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $4}'`
-driver=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $5}'`
+table=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+database=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
if [ -z "$table" ]
then
Modified: grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol 2010-01-08 05:44:02 UTC (rev 40310)
@@ -84,14 +84,14 @@
exit 1
fi
-table=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+table=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
if [ -z "$table" ] ; then
g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
exit 1
fi
-database=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
-driver=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
+database=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect "$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
colnum=`echo "$GIS_OPT_COLUMNS" | awk -F, '{print NF}'`
Modified: grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable 2010-01-08 05:44:02 UTC (rev 40310)
@@ -140,7 +140,7 @@
#maybe there is already a table linked to the selected layer?
if [ "$GIS_OPT_LAYER" -eq 1 ] ; then
- v.db.connect "$GIS_OPT_MAP" -g 2> /dev/null | grep -w "$GIS_OPT_LAYER" > /dev/null
+ v.db.connect "$GIS_OPT_MAP" -g 2> /dev/null | grep -w "^$GIS_OPT_LAYER" > /dev/null
if [ $? -eq 0 ] ; then
g.message -e "There is already a table linked to layer <$GIS_OPT_LAYER>"
exit 1
Modified: grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol 2010-01-08 05:44:02 UTC (rev 40310)
@@ -97,15 +97,15 @@
exit 1
fi
-table=`v.db.connect map=$GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | cut -f2 -d";"`
+table=`v.db.connect map=$GIS_OPT_MAP -g fs=";" | grep -w "^$GIS_OPT_LAYER" | cut -f2 -d";"`
if [ -z "$table" ] ; then
g.message -e 'There is no table connected to the input vector map! Cannot delete any column'
cleanup
exit 1
fi
-keycol=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f3 -d';'`
-database=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f4 -d';'`
-driver=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f5 -d';'`
+keycol=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w "^$GIS_OPT_LAYER" | cut -f3 -d';'`
+database=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w "^$GIS_OPT_LAYER" | cut -f4 -d';'`
+driver=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w "^$GIS_OPT_LAYER" | cut -f5 -d';'`
col="$GIS_OPT_COLUMN"
if [ "$col" = "$keycol" ] ; then
Modified: grass/branches/develbranch_6/scripts/v.db.droptable/v.db.droptable
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.droptable/v.db.droptable 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.droptable/v.db.droptable 2010-01-08 05:44:02 UTC (rev 40310)
@@ -78,7 +78,7 @@
g.message -e "An error occured while running v.db.connect"
exit 1
fi
- table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+ table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
if [ -z "$table" ] ; then
g.message -e "No table assigned to layer <$GIS_OPT_LAYER>"
exit 1
@@ -86,7 +86,7 @@
# Removing table name connected to selected layer
else
# Removing user specified table
- existingtable=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+ existingtable=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
table="$GIS_OPT_TABLE"
if [ "$existingtable" != "$table" ] ; then
g.message -e "User selected table <$table> but the table <$existingtable> is linked to layer <$GIS_OPT_LAYER>"
@@ -100,8 +100,8 @@
g.message -e "An error occured while running v.db.connect"
exit 1
fi
-database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
-driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
+database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
g.message "Removing table <$table> linked to layer <$GIS_OPT_LAYER> of vector map <$GIS_OPT_MAP>"
Modified: grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol 2010-01-08 05:44:02 UTC (rev 40310)
@@ -102,16 +102,16 @@
exit 1
fi
-table="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "$GIS_OPT_LAYER" | cut -f2 -d';'`"
+table="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "^$GIS_OPT_LAYER" | cut -f2 -d';'`"
if [ -z "$table" ] ; then
g.message -e 'There is no table connected to the input vector map! Cannot rename any column'
cleanup
exit 1
fi
-keycol=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f3 -d';'`
-database="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f4 -d';'`"
-driver=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f5 -d';'`
+keycol=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "^$GIS_OPT_LAYER" | cut -f3 -d';'`
+database="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w ^$GIS_OPT_LAYER | cut -f4 -d';'`"
+driver=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "^$GIS_OPT_LAYER" | cut -f5 -d';'`
oldcol="`echo $GIS_OPT_COLUMN | cut -d',' -f1`"
newcol="`echo $GIS_OPT_COLUMN | cut -d',' -f2`"
Modified: grass/branches/develbranch_6/scripts/v.db.update/v.db.update
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.update/v.db.update 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.db.update/v.db.update 2010-01-08 05:44:02 UTC (rev 40310)
@@ -99,14 +99,14 @@
exit 1
fi
-table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
if [ -z "$table" ] ; then
g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
exit 1
fi
-database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
-driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
+database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
# checking column types
coltype=`v.info -c map="$GIS_OPT_MAP" layer=$GIS_OPT_LAYER --quiet | grep -w "$GIS_OPT_COLUMN" | cut -d'|' -f1`
Modified: grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve 2010-01-08 05:44:02 UTC (rev 40310)
@@ -102,7 +102,7 @@
exit 1
fi
- table=`v.db.connect $GIS_OPT_INPUT -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $2}'`
+ table=`v.db.connect $GIS_OPT_INPUT -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
if [ -z "$table" ] ; then
g.message -e "Database connection not defined for layer $GIS_OPT_LAYER"
exit 1
Modified: grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats 2010-01-08 05:44:02 UTC (rev 40310)
@@ -197,7 +197,7 @@
#check if DBF driver used, in this case cut to 10 chars col names:
DBFDRIVER=0
-v.db.connect -g "$VECTOR" fs=";" | grep -w "$GIS_OPT_LAYER" | \
+v.db.connect -g "$VECTOR" fs=";" | grep -w "^$GIS_OPT_LAYER" | \
cut -d';' -f5 | grep -i dbf --quiet
if [ $? -eq 0 ] ; then
DBFDRIVER=1
@@ -222,7 +222,7 @@
DB_DATABASE="`v.db.connect -g "$VECTOR" fs=";" | cut -d';' -f4`"
#Find out which table is linked to the vector map on the given layer
-TABLE=`v.db.connect map="$VECTOR" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+TABLE=`v.db.connect map="$VECTOR" -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
if [ -z "$TABLE" ] ; then
g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
exit 1
Modified: grass/branches/develbranch_6/scripts/v.report/v.report
===================================================================
--- grass/branches/develbranch_6/scripts/v.report/v.report 2010-01-08 05:22:32 UTC (rev 40309)
+++ grass/branches/develbranch_6/scripts/v.report/v.report 2010-01-08 05:44:02 UTC (rev 40310)
@@ -94,9 +94,9 @@
TMP3="`g.tempfile pid=$$`"
TMP4="`g.tempfile pid=$$`"
-MAP=$GIS_OPT_MAP
-OPTION=$GIS_OPT_OPTION
-LAYER=$GIS_OPT_LAYER
+MAP="$GIS_OPT_MAP"
+OPTION="$GIS_OPT_OPTION"
+LAYER="$GIS_OPT_LAYER"
# does the input vector map exist?
eval `g.findfile element=vector file=$GIS_OPT_MAP`
@@ -143,7 +143,7 @@
if [ $TABLEEXISTS -eq 1 ] ; then
v.db.select -c map="$MAP" layer="$LAYER" | sort -n -t'|' -k 1 | grep -v '^0' > "$TMP1"
if [ `wc -l "$TMP1" | awk '{print $1}'` -eq 0 ] ; then
- KEY=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "$LAYER" | cut -f3 -d';'`
+ KEY=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "^$LAYER" | cut -f3 -d';'`
g.message -e "There is a table connected to input vector map '$MAP', but\
there are no categories present in the key column '$KEY'. Consider using\
v.to.db to correct this."
More information about the grass-commit
mailing list