The more command, The cat command, Displaying files with formatting (pr) – HP NonStop G-Series User Manual

Page 96: The more command the cat command

Advertising
background image

The general format of more and cat is the following:

command filename

The command entry is either more or cat. The filename entry can be the name of one file or a
series of filenames separated by spaces. You can also use pattern-matching characters to specify
your files. For more information on pattern-matching characters, see

Chapter 3 (page 31)

.

The more Command

The more command displays text files one screenful at a time. If the file contains more lines than
are on your screen, more pauses and displays a message telling you what percentage of the file
you have viewed thus far. When you see this message, you can do one of the following:

Press the space bar to display the remainder of the file, a page at a time

Press Return to display a line at a time

Type q to quit viewing the file

The cat Command

The cat command displays text continuously until it reaches the end. It is less useful for viewing
long files because it does not paginate files. When viewing a file that is larger than one screen,
the contents are displayed too quickly to be read.

Because cat is not very easy to use for viewing long files, you may prefer using the more command
in these cases.

The more and cat commands have additional options that you may find useful. For more
information, refer to the reference pages for these commands either online or in the Open System
Services Shell and Utilities Reference Manual
.

Displaying Files With Formatting (pr)

Formatting is the process of controlling the way the contents of your files appear when you display
or print them. The pr command formats a file in a simple but useful style.

To display a file with formatting, the general format of the pr command is:

pr filename

The filename entry can be the name of the file, the relative pathname of the file, the full pathname
of the file, or a list of filenames separated by spaces. The format you use depends on where the
file is located in relation to your current directory. You can also use pattern-matching characters
to specify files.

Used without any flags, the pr command does the following:

Divides the contents of the file into pages

Puts the date, time, page number, and filename in a heading at the top of each page

Leaves five blank lines at the end of the page

When you use the pr command to display a file, its contents may scroll down your screen too
quickly for you to read them. When this happens, you can view the formatted file by using the pr
command along with the more command. The more command instructs the system to pause at
the end of each screenful of text. See

“The more Command” (page 96)

for information on the more

command.

For example, suppose that you wish to display a long file, named report, so that the display
pauses when the screen is full. To do so, enter the following command:

$ pr report | more

When the system pauses at the first screenful of text, press the spacebar to display the next screen.
(To advance the display one line at a time, press Return.) This command uses the | (pipe) character

96

Managing Files

Advertising
This manual is related to the following products: