We just released GOL Tool 2.3, which now allows you to export the results of a query in OSM PBF format. This makes it easy to create regional or thematic extracts.
You can also filter tags using the --keys (-k) option.
Example:
gol query germany na[amenity=restaurant] -a bavaria.wkt -k amenity,cuisine,opening_hours > restaurants.osm.pbf
This queries germany.gol and creates a PBF containing all restaurants in Bavaria (specified as a Well-Known Text multipolygon), including only the amenity, cuisine and opening_hours tags.
Important: To ensure that untagged way-nodes are included in the output, build or load your GOL with the --waynode-ids (-w) option.
To get the (multi)polygon for the query’s --area (-a) option, first export the desired region like this:
gol query germany a[boundary=administrative][name:en=Bavaria] > bavaria.wkt