How to change a certain block with air?

Solution 1:

You need to replace [X1] [Y1] [Z1] [X2] [Y2] [Z2] with the coordinates between which you want to replace the blocks.

If you press F3 to open up the debug menu, then look at a block, you can see its coordinates:

Looking at coordinates

You will need to specify two opposite corners of the cuboid that you want to fill/replace, as such:

Fill coordinates

I've used stone to demonstrate the area that is filled, but you'll need have air 0 replace [block] after the coordinates. With the coordinates added, your command might look like this, with different numbers:

1.12-: /fill 5 10 7 12 20 15 air 0 replace sponge  
1.13+: /fill 5 10 7 12 20 15 air replace sponge  

Solution 2:

The syntax you wrote was a bit wrong, use this instead:

/fill X1 Y1 Z1 X2 Y2 Z2 minecraft:air 0 replace WhatYouWantToReplace

Replace X1 - Z2 with the edges of the cube you want to fill and WhatYouWantToReplace with what type of block you want to replace.

Example: to replace all grass blocks with air in a 10-block area around YOU (or the command block that executed the command), use this:

/fill ~+5 ~+5 ~+5 ~-5 ~-5 ~-5 minecraft:air 0 replace minecraft:grass