Osmium and Osmosis command tools have the capability of extracting a geographic extent from an OSM file.
osmosis
--read-xml test.osm --tee 1
--bounding-box left=15 top=46 --write-xml extract_test.osm
osmium extract -p city.geojson test.pbf -o extract_test.pbf
What I need is to extract region from an OSM file like a city and after some edits, merge it with the OSM file with the hole (excluded the city region). How can I exclude or clip a geographic extent from original file?