pg Command Purpose Formats files to the display. Syntax pg [ - Number ] [ -c ] [ -e ] [ -f ] [ -n ] [ -p String ] [ -s ] [ +LineNumber | +/ Pattern/ ] [ File ... ] Description The pg command reads the file names from the File parameter and writes them to standard output one screen at a time. If you specify - (minus) as the File parameter, or run the pg command without options, the pg command reads standard input. Each screen is followed by a prompt. If you press the Enter key, another page is displayed. Subcommands used with the pg command let you review something that has already passed. To determine workstation attributes, the pg command scans the file for the workstation type specified by the TERM environment variable. The default type is dumb. When the pg command pauses and issues its prompt, you can issue a subcommand. Some of these subcommands change the display to a particular place in the file, some search for specific patterns in the text, and others change the environment in which the pg command works. The following subcommands display a selected place in the file: Page Displays the page specified by the Page parameter. +Number Displays the page obtained by adding the Number value to the current page. -Number Displays the page as specified by the Number value before the current page. l Scrolls the display one line forward. Numberl Displays a screen with the specified line Number at the top. +Numberl Scrolls the display forward for the specified number of lines. -Numberl Scrolls the display backward for the specified number of lines. d Scrolls half a screen forward. Pressing the Ctrl-D key se- quence also does this. -d Scrolls half a screen backward. Pressing the -Ctrl-D key se- quence also does this. Ctrl-L Displays the current page again. A single . (dot) also does this. $ Displays the last page in the file. Do not use this when the input is from a pipeline. The following subcommands search for text patterns in the text. (You can also use the patterns described in the ed command.) They must always end with a new-line character, even if the -n flag is used. In an expression such as [k.a-z]k., the minus implies a range, as in a through z, according to the current collating sequence. A collating sequence defines equivalence classes for use in charac- ter ranges. [Number]/Pattern/ Searches for the occurrence of the Pattern value as specified by the Number variable. The search begins im- mediately after the current page and continues to the end of the current file, without wraparound. The default for the Number variable is 1. Number?Pattern? Number\^Pattern\^ Searches backward for the occurrence of the Pattern value as specified by the Number variable. The searching begins immediately before the current page and continues to the beginning of the current file, without wraparound. The default for the Number variable is 1. After searching, the pg command displays at the top of the screen the line that was found in the search. You can change this by adding m or b to the search command. These flags cause the line found in the search in the middle or at the bottom of the screen, for all succeeding subcommands. Use the t suffix to have the line with the matching pattern displayed at the top of the screen again. You can change the pg command environment with the following sub- commands: [Number]n Begins examining the next file in the command line, as specified by the Number variable. The default for the Number variable is 1st. [Number]p Begins examining the previous file on the command line, as specified by the Number variable. The default for the Number variable is first. [Number]w Displays another window of text. If the Number vari- able is specified, sets the window size to the number of lines it specifies. s File Saves the input in the specified file. Only the current file being examined is saved. This command must always end with a new-line character, even if you specify the -n flag. h Displays an abbreviated summary of available subcommands. q or Q Quits the pg command. !Command Sends the specified command to the shell named in the SHELL environment variable. If this is not available, the de- fault shell is used. This command must always end with a new- line character, even if the -n flag is used. At any time output is being sent to the workstation, you can press the QUIT WITH DUMP (Ctrl-\) or INTERRUPT (Ctrl-C) key se- quence. This causes the pg command to stop sending output and displays the prompt. Then you can enter one of the preceding commands in the normal manner. If standard output is not a workstation, the pg command acts like the cat command, except that a header is displayed before each file. While waiting for workstation input, the pg command stops running when you press the INTERRUPT key sequence. Between prompts these signals interrupt the current task and place you in the prompt mode. Warning: 1. Some output is lost when you press the QUIT WITH DUMP or IN- TERRUPT key sequence because any characters waiting in the output queue are purged when the QUIT signal is received. 2. If workstation tabs are not set every eight positions, unpredictable results can occur. Flags -c Moves the cursor to the home position and clears the screen before each page. This flag is ignored if the clear_screen field is not defined for your work station type in the terminfo file. -e Does not pause at the end of each file. -f Does not split lines. Normally, the pg command splits lines longer than the screen width. -n Stops processing when a pg command letter is entered. Normal- ly, commands must end with a new-line character. -p String Uses the specified string as the prompt. If the String contains a %d value, that value is replaced by the current page number in the prompt. The default prompt is : (colon). If the specified string contains spaces, you must enclose the string in quotation marks. -s Highlights all messages and prompts. +LineNumber Starts at the specified line number. -Number Specifies the number of lines in the window. On worksta- tions that contain 24 lines, the default is 23. +/Pattern/ Starts at the first line that contains the specified pattern. Examples To look at the contents of a file one page at a time, enter: pg filename Implementation Specifics This command is part of Base Operating System (BOS) Runtime. Files /usr/bin/pg Contains the pg command. /usr/share/lib/terminfo/* Contains the terminfo file that defines terminal types. /tmp/pg* Contains the temporary file created when using the pg command. Related Information Files Overview in AIX Version 3.2 System User's Guide: Base and Devices. Understanding File and Directory Access Modes in AIX Version 3.2 System Management Guide: Operating System and Devices. Input and Output Redirection Overview in AIX Version 3.2 System User's Guide: Base and Devices. Shells Overview in AIX Version 3.2 System User's Guide: Base and Devices. The cat command, ed command, grep command.