I have some text files which contain some long lines. Now I would like to break lines to at most 80 characters. How to wrap long lines in a text file on Linux?
fold command can wrap lines.
fold – wrap each input line to fit in specified width
For your purpose,
fold -w 80 -c in.txt > out.txt
fold has more options, you may check
count bytes rather than columns
count characters rather than columns
break at spaces
use WIDTH columns instead of 80