1

I have a textfile that contains a story with many paragraphs and I want to print the story in the terminal, I also want to make it so when it finds a blank line in the textfile it adds another blank line to this in the whole story and print this as a new file.

I have this code but it only appends a new line when it finds a fullstop (so it adds a blank line to every sentence) and prints this as a new file:

awk -v RS="." '/^./ { print " " $0 " " }' < 52293-0.txt > output

What mistake am I making?

Many thanks,

Taran Basi
  • 35
  • 2
  • 7
  • You can do the same with sed : sed -i 's/^$/\n\n/g' . '^$' means an empty line, which is replaced with '\n\n', i.e, two newlines. – rmn Mar 14 '19 at 13:19
  • Thanks, I ran that command but it didn't do anything to the textfile, it didn't add any two newlines and stayed exactly the same. – Taran Basi Mar 14 '19 at 17:30
  • Can you post the contents of the file and the result of running the command. – rmn Mar 14 '19 at 18:39

0 Answers0