C Shell Wiki
Posts (Latest 10 updated) :
Read all
Contents:
  1. [Unix] C Shell (csh) pr : Format text for printing
    1. Overview
    2. Usage
    3. Common Options
    4. Common Examples
    5. Tips

[Unix] C Shell (csh) pr : Format text for printing

Overview

The pr command in C Shell (csh) is used to format text files for printing. It organizes text into a paginated format, making it easier to read when printed. This command can add headers, footers, and manage line widths, allowing for a clean presentation of text documents.

Usage

The basic syntax of the pr command is as follows:

pr [options] [arguments]

Common Options

  • -h <header>: Specify a custom header for the output.
  • -f: Suppress the output of the page form feed.
  • -l <number>: Set the number of lines per page (default is 66).
  • -w <number>: Set the output width in characters (default is 72).
  • -t: Suppress the printing of the header and footer.

Common Examples

Here are several practical examples of using the pr command:

  1. Basic Formatting of a Text File:
    pr myfile.txt
    
  2. Custom Header:
    pr -h "My Custom Header" myfile.txt
    
  3. Setting Lines Per Page:
    pr -l 50 myfile.txt
    
  4. Suppressing Header and Footer:
    pr -t myfile.txt
    
  5. Setting Output Width:
    pr -w 80 myfile.txt
    

Tips

  • Use the -h option to add context to your printed documents, making them more informative.
  • Adjust the line width and lines per page to fit your specific printing needs and paper size.
  • Combine options for more customized output, such as setting both a header and a specific line width.
  • Always preview your document with pr before printing to ensure it appears as expected.