[[+content_image]]
V
V
VN2021-06-18 10:09:36
bash
VN, 2021-06-18 10:09:36

How to move output after dot to new line?

grep linux get sentences from file

grep -E '[[:upper:][:lower:][:punct:] ]*\.' sentence.txt


Tell me how to make a conclusion after a dot on a new line?

I tried tr, it wraps, but it eats up the point and adds a space.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Sand, 2021-06-18
@kavabangaungava

Output to standard stream:
sed -e 's/\.\s/\.\n/g' sentence.txt
Replacement in file:
sed -i 's/\.\s/\.\n/g' sentence.txt

S
Saboteur, 2021-06-19
@saboteur_kiev

You can add a gray line where there is no hyphen after the dot:

grep -E '[[:upper:][:lower:][:punct:] ]*\.' sentence.txt|sed 's/\.\s/.\n/g'

In general, your regular expression is incomprehensible. Double upper? no split inside string?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question