With the example commandman apropos > outputfilea text file is generated which contains the formatted man page of apropos (with some little differences with respect to man apropos directly printed on screen, such as bold characters).But I would like to manually set the maximum line width of the generated output file, so that all the paragraphs will be justified to that width.man pages are created through groff: for example, I tried to put .ll 50 before a paragraph of the original .gz man source text file, but it is trivial if I need to work on several man pages. Moreover not all the characters are recognized:apropos.1:45: warning: can't find character with input code 195apropos.1:45: warning: can't find character with input code 168apropos.1:47: warning: can't find character with input code 178apropos.1:131: warning: can't find character with input code 169So, I wonder if a more straightforward method exists. How to modify the maximum line width, during the creation of an outputfile? Is there some specific command?
Print man pages with fixed width
shell;command line;text processing;man;text formatting
Try setting the COLUMNS environment variable. Works for me with man from mandb 2.7.0.2 on Debian with groff 1.22.3.$COLUMNS=60 man apropos | headAPROPOS(1)          Manual pager utils          APROPOS(1)NAME       apropos - search the manual page names and descrip       tionsSYNOPSIS       apropos [-dalv?V] [-e|-w|-r]  [-s  list]  [-m  sys$COLUMNS=70 man apropos | headAPROPOS(1)               Manual pager utils               APROPOS(1)NAME       apropos - search the manual page names and descriptionsSYNOPSIS       apropos  [-dalv?V] [-e|-w|-r] [-s list] [-m system[,...]] [-M       path] [-L locale] [-C file] keyword ...With the version on Ubuntu 14.04, I need to write it:COLUMNS=60 < /dev/null man apropos | headThere, man seems to disregard the COLUMNS environment variable if stdin is a terminal (it then queries the terminal device for the terminal width).You can also try:s=$(stty -g); stty cols 60; man apropos | head; stty $sWhich with zsh you can shorten to:STTY='cols 60' man apropos | headYou could do it by invoking groff by hand as:gzip -dcf $(man -w apropos) |  groff -ekpstR -mtty-char -mandoc -Tutf8 -rLL=60n |  col -bpxYour can't find character with input code errors were because you used -Tascii instead of -Tutf8 and didn't use -k to pre-process the files with preconv.