Conversation

I have a .md file where I want to move every sentence to its own line. How do I do that?

I have tried

tr '\. ' ' \n' <input.md >output.md

But that results in a new line being added to every space, which means moving every single word to its own line

3
0
0
@schratze i think \. may be parsed out as . so you might need to mess around with how many backslashes you need xkcd1638 style
0
0
1

@schratze \\. should work, you're escaping dot at shell, not in the chars tr sees.

1
0
0

@schratze i think tr just replaces the set on the right with items from the set of the left, and in this case the one on the right is extended with more \ns.

you could try sed:

sed 's|\. |\n|g' < input.md 
1
0
0

@owl @schratze This one deletes the periods, you likely want:

sed 's|\. |.\n|g' < input.md >output.md

(I checked on a small example and it seems to work.)

1
1
0

@timorl @owl hell yeah, this one works! I just had to add a space after the second dot so that spaces are preserved, too

0
0
0