[Qgis-user] Re: Merging 3 different Shapefiles

Hermann Peifer peifer at gmx.eu
Thu Jun 3 06:34:40 PDT 2010


On 02/06/2010 18:43, Duarte Carreira wrote:
>
> I wish I knew a way to automate this kind of thing, without being a bash shell guru...
>

You can have a look here:

http://trac.osgeo.org/gdal/wiki/FAQVector#HowcanImergehundredsofShapefiles


Below the bash script that I use occasionally. You do not have to be a 
bash guru to start the script...

Hermann


#!/bin/sh

FIRST=$(ls path/to/shapefiles/*.shp | awk 'NR==1')
OTHER=$(ls path/to/shapefiles/*.shp | awk 'NR>1')

ogr2ogr target.shp "$FIRST"

for SHP in "$OTHER"
do
     ogr2ogr -update -append -nln target target.shp "$SHP"
done



More information about the Qgis-user mailing list