Matthew 5:6 is the sixth verse of the fifth chapter of the Gospel of Matthew in the New Testament. It is the fourth verse of the Sermon on the Mount, and also the fourth of what are known as the Beatitudes.

Content
In the King James Version of the Bible the text reads:
Blessed are they which do hunger 
and thirst after righteousness: 
for they shall be filled

The World English Bible translates the passage as:
Blessed are those who hunger 
and thirst after righteousness,
for they shall be filled.

The Novum Testamentum Graece text is:
μακάριοι οἱ πεινῶντες
καὶ διψῶντες τὴν δικαιοσύνην, 
ὅτι αὐτοὶ χορτασθήσονται.

For a collection of other versions see BibleHub Matthew 5:6

Analysis
Albright and Mann note that fasting was a common sign of righteousness, and one that Jesus has already endured at Matthew 4:2. The metaphor of God or the messiah as a feast ending a fast occurs several times in the scripture including Isaiah 55:1, Jeremiah 31:25, and Psalm 107:9. 

Like the first two Beatitudes this one seems to be similar to one in Luke, in this case with Luke 6:21. Luke only has the blessed hunger, Gundry feels the author of Matthew added thirst to match Isaiah 49:10. Schweizer feels that the addition of thirst is a minor one, but the addition of the word righteousness is a major one. As with Matthew 5:3, the author of Matthew turns a phrase that focuses on the merely physical in Luke into one far more focused on the spiritual. Righteousness is one of the key concepts in the Gospel of Matthew, though what exactly is meant by the term is not always clear. All the references to righteousness in the Gospel are unique to Matthew, and thus likely are additions by the author.

Commentary from the Church Fathers
Ambrose:  As soon as I have wept for my sins, I begin to hunger and thirst after righteousness. He who is afflicted with any sore disease, hath no hunger.

Jerome: It is not enough that we desire righteousness, unless we also suffer hunger for it, by which expression we may understand that we are never righteous enough, but always hunger after works of righteousness.

Pseudo-Chrysostom: All good which men do not from love of the good itself is unpleasing before God. He hungers after righteousness who desires to walk according to the righteousness of God; he thirsts after righteousness who desires to get the knowledge thereof.

Chrysostom: He may mean either general righteousness, or that particular virtue which is the opposite of covetousness.  As He was going on to speak of mercy, He shows beforehand of what kind our mercy should be, that it should not be of the gains of plunder or covetousness, hence He ascribes to righteousness that which is peculiar to avarice, namely, to hunger and thirst.

Hilary of Poitiers: The blessedness which He appropriates to those who hunger and thirst after righteousness shows that the deep longing of the saints for the doctrine of God shall receive perfect replenishment in heaven; then they shall be filled.

Pseudo-Chrysostom: Such is the bounty of a rewarding God, that His gifts are greater than the desires of the saints.

Augustine:  Or He speaks of food with which they shall be filled at this present; to wit, that food of which the Lord spake, My food is to do the will of my Father, that is, righteousness, and that water of which whoever drinks it shall be in him a well of water springing up to life eternal.

Chrysostom: Or, this is again a promise of a temporal reward; for as covetousness is thought to make many rich, He affirms on the contrary that righteousness rather makes rich, for He who loves righteousness possesses all things in safety.

References

05:06
Beatitudes
Christian fasting