hemanth reddy
hemanth reddy

Reputation: 35

Split a text into multiple sentences in bash

I would like to split text into sentences. Sentence ends with a dot and followed by whitespace character.

Upvotes: 0

Views: 1765

Answers (2)

user3442743
user3442743

Reputation:

This will print each separate sentence on a new line.

awk  'BEGIN{RS="\\. "}1' file

Upvotes: 1

perreal
perreal

Reputation: 97948

Using tr/sed:

tr '\n' ' ' <  input | sed -e 's/[.] \s*/. \n/g'

Upvotes: 1

Related Questions