Gostaria de saber como eu compacto as linhas de um txt. Por exemplo as linhas estão quebradas por \n
mas ainda fazem parte da mesma sentença.
SOCIAL HISTORY:Denies tobacco or alcohol use.
PHYSICAL EXAMINATION:
VITAL SIGNS: Age 34, blood pressure 128/78, pulse 70, temperature is 97.8,
weight is 207 pounds, and height is 5 feet 7 inches.
GENERAL: The patient is healthy appearing; alert and oriented to person, place
and time; responds appropriately; in no acute distress.
HEAD: Normocephalic. No masses or lesions noted.
FACE: No facial tenderness or asymmetry noted.
ou blocos inteiros de texto como:
A complete refractive work-up was performed today, in which we found a mild
change in her distance correction, which allowed her the ability to see 20/70
in the right eye and 20/200 in the left eye. With a pair of +4 reading
glasses, she was able to read 0.5M print quite nicely. I have loaned her a
pair of +4 reading glasses at this time and we have started her with fine-
detailed reading. She will return to our office in a matter of two weeks and
we will make a better determination on what near reading glasses to prescribe
for her. I think that she is an excellent candidate for low vision help. I am
sure that we can be of great help to her in the near future.
que eu queria que ficassem em uma linha só.
Eu preciso que cada linha corresponda a sua identificação como por exemplo IDENTIFICACAO: SENTENÇA SEM QUEBRA DE LINHA
IDENTIFICACAO: SENTENÇA SEM QUEBRA DE LINHA
Afim de que cada identificação fique em uma linha apenas.
as palavras são diferentes por isso não da pra usar o replace
.
Outro ploblema é que tem arquivos txt
que nao estão quebrados:
IDENTIFICACAO: SENTENÇA SEM QUEBRA DE LINHA. IDENTIFICACAO: SENTENÇA SEM QUEBRA DE LINHA. IDENTIFICACAO: SENTENÇA SEM QUEBRA DE LINHA
Eu estava usando regex mas não esta funcionando.