On 01:24:35, 5.01.16, Ingo Schwarze wrote: > +If an output line would be broken after a non-blank character but > +contains at least one blank character, break the line earlier, > +after the last blank character. > +This is useful to avoid line breaks in the middle of words, if > +possible.
After a second look, even though the current documentation mentions a "blank character" the source code shows that in fact a space is meant: if (split_words) { for (i = 0, last_space = -1; i < indx; i++) if(buf[i] == ' ') last_space = i; } $ echo -e '7777777\taaaaaaaaaaaaa' | fold -sw 16 7777777 aaaaaaaa aaaaa The comment in the code has it right: * If split_words is set, split the line at the last space character * on the line. I don't know how to make this description more readable yet precise, maybe at least "blank" should be replaced with "space": Index: fold.1 =================================================================== RCS file: /cvs/src/usr.bin/fold/fold.1,v retrieving revision 1.16 diff -u -p -r1.16 fold.1 --- fold.1 28 Dec 2011 22:27:18 -0000 1.16 +++ fold.1 5 Jan 2016 07:13:22 -0000 @@ -54,9 +54,11 @@ Count .Ar width in bytes rather than column positions. .It Fl s -Fold line after the last blank character within the first +Fold line after the last space character within the first .Ar width column positions (or bytes). +If a space character does not exist within the width, then +a longer line will still be split at the width. .It Fl w Ar width Specifies a line width to use instead of the default 80 characters. .El -- Michal Mazurek