[GRASS5] Re: creating a table from ascii data?

Hamish hamish_nospam at yahoo.com
Tue Oct 26 23:34:54 EDT 2004


> > I prefer db.in.ascii as copy-paste from v.in.ascii (cca 300 rows).
> 
> 
> Would you prefer db.in.ascii or
>   echo "COPY table FROM 'filename.txt'" | db.execute
> support added to db/drivers/dbf/dbfexe.c(??) ?


for now this hack works with the 'INSERT INTO table VALUES' SQL command:


# =>  echo "INSERT INTO $NAME VALUES (2, 1, 'AB', 'B')" | db.execute

cat "$ATTR_FILE" | \
  awk -F'\t' '{ printf("echo \"INSERT INTO $NAME VALUES (%d, %d, ^%s^, ^%s^)\" | db.execute\n", $1, $2, $3, $4) }' \
    | tr '^' \' >  "$ATTR_FILE"_exe

. "$ATTR_FILE"_exe


(depends on $ATTR_FILE format being stable)


This adds some nice attribute tables to v.in.garmin.


we should still do db.in.ascii of course..


Hamish




More information about the grass-dev mailing list