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

Michael Barton michael.barton at asu.edu
Wed Oct 27 09:49:39 EDT 2004


Hamish,

For my 2 cent's worth, db.in.ascii is where a user would logically look
first to find a way to get an ascii file into the default dbf format. The
2nd most logical place to look (IMHO) would be v.in.ascii (with the flag
that you or someone else mentioned).

That said, making this doable anyplace is better than the current lack of
this functionality in a straightforward form.

Michael


On 10/26/04 8:34 PM, "Hamish" <hamish_nospam at yahoo.com> wrote:

>>> 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
> 
> 
> 

____________________
C. Michael Barton, Professor of Anthropology
School of Human, Cultural, and Social Change
PO Box 872402
Arizona State University
Tempe, AZ  85287-2402
USA

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>




More information about the grass-dev mailing list