How do I change a type of block in a specific area into another block? [duplicate]

How can I change all blocks in a specific area around me (where I am currently standing) to another block? I tried using the /setblock command, but it only works for a single block.

For example, if I wanted to replace all of the grass with mycelium in a range of +/- 140 blocks in the X or Z directions, covering the entire Y range, how would I do that?


You should use the fill command. You won't be able to do all 20 million blocks in the 280*256*280 area that you want to do at once (that's a really huge amount), but you'll be able to do smaller segments:

/fill ~-20 ~-8 ~-20 ~20 ~8 ~20 mycelium 0 replace grass