How to use -where SQL in an ogr2ogr loop in GDAL/OGR (bash)? @iant modifying the loop as you've suggested in the link to something like this wclause=newcode="$att"
ogr2ogr -where '$wclause' -f "ESRI Shapefile" $OUTPUT/$att.shp $INDATA created a syntax error in the SQL statement.