Friday, June 29, 2007

Wrap long lines using fold

To line wrap a text file at 80 columns, and only break at spaces, use the command:

cat filename.txt | fold -80 -s

fold can also be told to wrap at bytes instead of columns, but I've never been quite sure how that would be useful.

No comments: