how to remove all but one specific block
How I would do it would be create a spigot server with build tools and get world edit and Async world edit then do replaces.. //replace stone,dirt,cobblestone,grass air
You can also use itemid. U can replace as many as you want at once also, just do have , in between each.
just looked this up myself, try using a mask, a mask uses "!" followed by the name or id of the block you don't want to replace, in this case (chain) command blocks, ID 137: //replace !137 air
for my case, I wanted to delete every block in between the bedrock (ID 7) layers, but not the bedrock itself, so I used: //replace !7 air.
and if you are replacing all the blocks in an area except for air (ID 0) to something like stone (ID 1) for example, you would use something like this //replace !0 1
And so on and so forth, I hope this helps you and anyone else who may stumble across this.