The command man is very useful, however what if we want to move the content to the paper. The col is our friend here. To change every manual page into normal printable text file we type:
$ man ls | col -b > manls.txt
What happened here? The command col filters reverse line feeds and replaces white-space characters with tabs. We can now print manls.txt or go one step further. Using groff formating system and ps2pdf, which converts postscript files into pdf we can convert any manual to PDF file:
$ man ls | col -b | groff -Tps -fC | ps2pdf - > manls.pdf
This command passes our txt formatted manual into groff which converts it to postscript (-Tps), additionally we choose the courier font family as default (-fC, -fT is Times New Roman, -fA is Arial), because it looks better. In the end ps output is passed to ps2pdf which converts it to pdf and everything is put into manls.pdf file.
We can of course convert other files this way. Man is only an example.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment