fold(1) — Commands
OSF
NAME
fold − Breaks lines in a file
SYNOPSIS
fold [-width] [file ...]
The fold command breaks lines in the specified files, or the standard input if no files are specified, to have maximum width.
FLAGS
-widthSpecifies the maximum width to which lines should be folded.
DESCRIPTION
The default width is 80. width should be a multiple of 8 if tabs are present, or the tabs should be converted to spaces using expand before using fold.
Note that fold may affect any underlining that is present.
EXAMPLES
The fold command can be used to prepare files to be joined side-by-side with paste. You might want to display these two files, az and AZ, side-by-side:
aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm
nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz
AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM
NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ
The command line:
fold -32 az > az2; fold -32 AZ > AZ2; paste -d" " az2 AZ2
results in this output:
aaaa bbbb cccc dddd eeee ffff gg AAAA BBBB CCCC DDDD EEEE FFFF GG
gg hhhh iiii jjjj kkkk llll mmmm GG HHHH IIII JJJJ KKKK LLLL MMMM
nnnn oooo pppp qqqq rrrr ssss tt NNNN OOOO PPPP QQQQ RRRR SSSS TT
tt uuuu vvvv wwww xxxx yyyy zzzz TT UUUU VVVV WWWW XXXX YYYY ZZZZ
RELATED INFORMATION
Commands: expand(1)/unexpand(1), paste(1).