You can replace just the pieces that are bad, but it is tough and you usually end up damaging some of the good boards. This stuff goes bad over time, so it's probably just a matter of time before the rest goes bad. That is what happened to me.
First, get a pry bar and try to get it under the piece above the bad piece. Try to lift it clear without pulling the nail head through it. If he nail comes with it, then tap the board down and pull the nail out. Once you get the nails out of the board above the bad piece, you can pull the nails out of the bottom of the bad piece. You don't have to be overly careful with these. The bad piece will come right out.
Then cut a new piece to size and install. Use a good spiral siding nail.
Another variation I saw a repair man use on my house was to take a punch and drive the nail in the good piece all the way through. The nails in the bottom of the bad piece were just yanked out. He installed a new piece, and put nails about 1/2" away from where he drove the nail through the board. He then put caulking in the holes. The caulk didn't adequately protect the good board, and it went bad in a couple of years.
I switched from the masonite crap to Hardie plank. It's a cement type board. I found I had to pre-drill my holes with a hand drill and 1/8 concrete bit because it bullet holes the back when driving a nail. They claim the stuff won't soak up water.