Interesting parallels and chiastic structure in this section:
23:2a "You have scattered My flock and driven them away" (specific actions of shepherds)23:2b "you have not attended to the sheep" (general indictment)
23:2c "I will attend to you" (general promise of Yahweh's appropriate justice)
23:2d "for the bevil of your deeds" (specific condemnation of shepherds)
Or comparing vs 2 with 3 and the difference in what has been done and what Yahweh will do.
23:2 (Shepherds who destroy)
- driven away
- not attended
23:3 (what Yahweh will do)
- I will gather the remnant
- where I have driven them (note contrast with shepherds driving away)
- I will bring them back to the fold
And the result:
23:4 (Yahweh's actions continue)
Shepherds will care for them
They shall fear no more nor be dismayed
None shall be missing
Ultimately it is God's appropriate justice upon the shepherds and the nation that leads to their captivity. But it is also his appropriate justice to bring them back to their own land.
23:8 (Yahweh says) "... Then they will live on their own soil."