Rip subtitles to text file

Does anyone know if it is possible to rip a DVDs subtitles to have it as one long text file. if so how do you do it

Thanks