Re: [GRASS-user] for looping using attribute levels of a vector
Milton Cezar Ribeiro wrote: Dear R-gurus, I have a vector file which have several attributes. One of the columns have values that repeat like the name of city. So, I would like to do some steps for each level of the column of interest. Just supose that I have CityA, CityB, CityC I would like to use this strings on a for loop. Following suggestions by Hamish, I addapted the following temptative code: for MAP in `v.db.select map=mymap column=city` ; do echo my steps... done But when the first entry on the looping is the name of the field (City), and when the city have white space like Los Angeles, each word are used as different entry of MAP variable of the for looping. My questions are: 1. How can I bypass the problem of v.db.select return the name of column as first entry 2. How can I bypass the problem of white space for city names? Best wishes miltinho astronauta brazil ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user 1. Looking at the docs -c drops the column name. 2. Hmm, you probably need to find a way to encapsulate each line in quotes for the loop reads each string or put a delimiter in that you can parse. maybe try vs=, to add a character. http://grass.itc.it/grass63/manuals/html63_user/v.db.select.html Alex ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] for looping using attribute levels of a vector
On Sat, 2008-10-11 at 00:55 -0700, Alex Mandel wrote: Milton Cezar Ribeiro wrote: Dear R-gurus, [...] 2. How can I bypass the problem of white space for city names? [...] 2. Hmm, you probably need to find a way to encapsulate each line in quotes for the loop reads each string or put a delimiter in that you can parse. maybe try vs=, to add a character. http://grass.itc.it/grass63/manuals/html63_user/v.db.select.html Dear Milton, you work under linux, right? Does it work if you use tr? For example: echo ano rizoma | tr ' ' '_' Regards, Nikos ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] for looping using attribute levels of a vector
Dear R-gurus, I have a vector file which have several attributes. One of the columns have values that repeat like the name of city. So, I would like to do some steps for each level of the column of interest. Just supose that I have CityA, CityB, CityC I would like to use this strings on a for loop. Following suggestions by Hamish, I addapted the following temptative code: for MAP in `v.db.select map=mymap column=city` ; do echo my steps... done But when the first entry on the looping is the name of the field (City), and when the city have white space like Los Angeles, each word are used as different entry of MAP variable of the for looping. My questions are: 1. How can I bypass the problem of v.db.select return the name of column as first entry 2. How can I bypass the problem of white space for city names? Best wishes miltinho astronauta brazil ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user