There is a project in our Code Community code.thinkgeo.com/ that shows how to dissolve a shapefile based on a common attribute. Dissolve in a type of geoprocessing that can be applied to a layer.
You can find that project at code.thinkgeo.com/projects/s...nshapefile