How to print a text file separated by 3 paragraphs?

Taran Basi

New Member
Joined
Mar 7, 2019
Messages
4
Reaction score
0
Credits
0
I have a textfile that contains a story from a book, and I want the Linux terminal to print out this story but with paragraphs that are 3 lines long.

What would be the best command to use?

Thanks
 


G'day @Taran Basi and welcome to linux.org :)

I am moving this Thread to Command Line where it will attract more specialised knowledge and responses.

Let us know what version of Ubuntu you are using.

Good luck

Chris Turner
wizardfromoz
 
3 lines long sounds relative to the width of your terminal and would likely break in the middle of sentences..

Do you mean each paragraph wants to be 3 sentences long?
 
3 lines long sounds relative to the width of your terminal and would likely break in the middle of sentences..

Do you mean each paragraph wants to be 3 sentences long?

Yes, that's it.
 
How do I print a textfile making each paragraph 3 lines long in the Linux terminal?

Many thanks.
 
... I want the Linux terminal to print out this story but with paragraphs that are 3 lines long.

Your description isn't clear. But if the text is longer than the screen width and you want it to wrap, you could use the fold utility, which is part of coreutils and is surely included in every distro.

Code:
fold -sw74 file.txt

Use -s to break at spaces. Use -w74 to set the width to 74 columns.
 


Latest posts

Top