[GRASSLIST:9159] Re: import shapefile with v.in.ogr and a script , qgis

Paul Kelly paul-grass at stjohnspoint.co.uk
Sun Nov 20 11:09:42 EST 2005


On Sun, 20 Nov 2005, Markus Neteler wrote:

> ---script begins---
> #!/bin/sh
>
> for i in *.shp
> do
>  echo "importing shape $i..."
>  NAME=`basename $i .shp`
>  v.in.ogr dsn=$i out=$NAME
> done
> ---script end---

And here is my take on it (untested) :)
(Markus's use of basename is tidier than my sed but I left it in to show a 
different way of doing it.) This is untested but should work for filenames 
with spaces in them.
---script begins---
#!/bin/sh

ls -1 *.shp | while read i
do
   echo "importing shape $i..."
   v.in.ogr dsn="$i" out="`echo $i | sed 's/\.shp$//'`"
done
---script end---

Paul




More information about the grass-user mailing list