<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>The Linux Printing Usage HOWTO: Miscellaneous Items</TITLE> <LINK HREF="Printing-Usage-HOWTO-5.html" REL=next> <LINK HREF="Printing-Usage-HOWTO-3.html" REL=previous> <LINK HREF="Printing-Usage-HOWTO.html#toc4" REL=contents> </HEAD> <BODY> <A HREF="Printing-Usage-HOWTO-5.html">Next</A> <A HREF="Printing-Usage-HOWTO-3.html">Previous</A> <A HREF="Printing-Usage-HOWTO.html#toc4">Contents</A> <HR> <H2><A NAME="s4">4. Miscellaneous Items</A></H2> <P>This covers topics not in any of the others. <P> <H2><A NAME="ss4.1">4.1 Formatting Before Printing</A> </H2> <P> <!-- printing!formatting files before --> Since most ASCII files are not formatted for printing, it is useful to format them in some way before they are actually printed. This may include putting a title and page number on each page, setting the margins, double spacing, indenting, or printing a file in multiple columns. A common way to do this is to use a print preprocessor such as <EM>pr</EM>. <P> <BLOCKQUOTE><CODE> <PRE> $ pr +4 -d -h"Ph.D. Thesis, 2nd Draft" -l60 thesis.txt | lpr </PRE> </CODE></BLOCKQUOTE> <P>In the above example, <EM>pr</EM> would take the file <CODE>thesis.txt</CODE> and skip the first three pages (+4), set the page length to sixty lines (-l60), double space the output (-d), and add the phrase "Ph.D. Thesis, 2nd Draft" to the top of each page (-h). <EM>Lpr</EM> would then queue <EM>pr</EM>'s output. See its on-line manual page for more information on using <EM>pr</EM>. <P> <H2><A NAME="ss4.2">4.2 The PRINTER Environment Variables</A> </H2> <P> <!-- printing!PRINTER environment variable --> <!-- PRINTER environment variable --> All of the commands in the Linux printing system accept the -<B>P</B> option. This option allows the user to specify which printer to use for output. If a user doesn't specify which printer to use, then the default printer will be assumed as the output device. <P>Instead of having to specify a printer to use every time that you print, you can set the PRINTER environment variable to the name of the printer that you want to use. This is accomplished in different ways for each shell. For <EM>bash</EM> you can do this with <P> <BLOCKQUOTE><CODE> <PRE> $ PRINTER="printer_name"; export PRINTER </PRE> </CODE></BLOCKQUOTE> <P>and <EM>csh</EM>, you can do it with <P> <BLOCKQUOTE><CODE> <PRE> % setenv PRINTER "printer_name" </PRE> </CODE></BLOCKQUOTE> <P>These commands can be placed in your login scripts (.profile for <EM>bash</EM>, or .cshrc for <EM>csh</EM>), or issued on the command-line. (See <EM>bash</EM>(1) and <EM>csh</EM>(1) for more information on environment variables.) <P> <P> <HR> <A HREF="Printing-Usage-HOWTO-5.html">Next</A> <A HREF="Printing-Usage-HOWTO-3.html">Previous</A> <A HREF="Printing-Usage-HOWTO.html#toc4">Contents</A> </BODY> </HTML>